Merge "Issue #1480 guarantee that framesInfo returned from descriptor is always valid." into development

Former-commit-id: a3a7dc44c9 [formerly 2069b8265416fae4c8fbeb37b4686b85428eca7f]
Former-commit-id: 7009876544
This commit is contained in:
Lee Venable 2013-01-14 17:47:59 -06:00 committed by Gerrit Code Review
commit c3dec53498
2 changed files with 10 additions and 1 deletions

View file

@ -604,6 +604,15 @@ public abstract class AbstractDescriptor extends ResourceGroup implements
int idx = frameIndex;
if (frames != null) {
frames = Arrays.copyOf(frames, frames.length);
if (idx < 0 || idx >= frames.length) {
// This only happens for 4-panels with shared time managers.
idx = frames.length - 1;
}
} else {
// It should already be -1 already but this is here for
// certain 4 panels where the time manager is shared and the
// index and frames are out of sync.
idx = -1;
}
Map<AbstractVizResource<?, ?>, DataTime[]> timeMap = new HashMap<AbstractVizResource<?, ?>, DataTime[]>(
timeMatchingMap);

View file

@ -304,7 +304,7 @@ public class D2DTimeMatcher extends AbstractTimeMatcher {
// Next try to get the closest time to
DataTime[] origSteps = currInfo.getFrameTimes();
int curIndex = currInfo.getFrameIndex();
if (origSteps != null && curIndex > 0 && curIndex < origSteps.length) {
if (origSteps != null && curIndex >= 0 && curIndex < origSteps.length) {
DataTime startTime = origSteps[curIndex];
int dateIndex = Arrays.binarySearch(timeSteps, startTime);
if (dateIndex < 0) {