if (instant + iGapDuration < iCutover) {
instant = gregorianToJulian(instant);
}
// Verify that new value stuck.
if (get(instant) != value) {
throw new IllegalFieldValueException
(iGregorianField.getType(), new Integer(value), null, null);
}
}
} else {
instant = iJulianField.set(instant, value);
if (instant >= iCutover) {
// Only adjust if gap fully crossed.
if (instant - iGapDuration >= iCutover) {
instant = julianToGregorian(instant);
}
// Verify that new value stuck.
if (get(instant) != value) {
throw new IllegalFieldValueException
(iJulianField.getType(), new Integer(value), null, null);
}
}
}
return instant;