--- old/src/share/classes/java/time/temporal/JulianFields.java 2013-04-11 23:15:50.000000000 -0700 +++ new/src/share/classes/java/time/temporal/JulianFields.java 2013-04-11 23:15:49.000000000 -0700 @@ -66,6 +66,7 @@ import static java.time.temporal.ChronoUnit.FOREVER; import java.time.DateTimeException; +import java.time.format.ResolverStyle; import java.util.Collections; import java.util.Map; @@ -106,7 +107,12 @@ * When 'JULIAN_DAY.adjustInto()' is applied to a date-time, the time of day portion remains unaltered. * 'JULIAN_DAY.adjustInto()' and 'JULIAN_DAY.getFrom()' only apply to {@code Temporal} objects that * can be converted into {@link ChronoField#EPOCH_DAY}. - * A {@link DateTimeException} is thrown for any other type of object. + * An {@link UnsupportedTemporalTypeException} is thrown for any other type of object. + *

+ * In the resolving phase of parsing, a date can be created from a Julian Day field. + * In {@linkplain ResolverStyle#STRICT strict mode} and {@linkplain ResolverStyle#SMART smart mode} + * the Julian Day value is validated against the range of valid values. + * In {@linkplain ResolverStyle#LENIENT lenient mode} no validation occurs. *

*

Astronomical and Scientific Notes

* The standard astronomical definition uses a fraction to indicate the time-of-day, @@ -147,10 +153,15 @@ * When 'MODIFIED_JULIAN_DAY.adjustInto()' is applied to a date-time, the time of day portion remains unaltered. * 'MODIFIED_JULIAN_DAY.adjustInto()' and 'MODIFIED_JULIAN_DAY.getFrom()' only apply to {@code Temporal} objects * that can be converted into {@link ChronoField#EPOCH_DAY}. - * A {@link DateTimeException} is thrown for any other type of object. + * An {@link UnsupportedTemporalTypeException} is thrown for any other type of object. *

* This implementation is an integer version of MJD with the decimal part rounded to floor. *

+ * In the resolving phase of parsing, a date can be created from a Modified Julian Day field. + * In {@linkplain ResolverStyle#STRICT strict mode} and {@linkplain ResolverStyle#SMART smart mode} + * the Modified Julian Day value is validated against the range of valid values. + * In {@linkplain ResolverStyle#LENIENT lenient mode} no validation occurs. + *

*

Astronomical and Scientific Notes

*
      *  | ISO date          | Modified Julian Day |      Decimal MJD |
@@ -180,7 +191,12 @@
      * When 'RATA_DIE.adjustInto()' is applied to a date-time, the time of day portion remains unaltered.
      * 'RATA_DIE.adjustInto()' and 'RATA_DIE.getFrom()' only apply to {@code Temporal} objects
      * that can be converted into {@link ChronoField#EPOCH_DAY}.
-     * A {@link DateTimeException} is thrown for any other type of object.
+     * An {@link UnsupportedTemporalTypeException} is thrown for any other type of object.
+     * 

+ * In the resolving phase of parsing, a date can be created from a Rata Die field. + * In {@linkplain ResolverStyle#STRICT strict mode} and {@linkplain ResolverStyle#SMART smart mode} + * the Rata Die value is validated against the range of valid values. + * In {@linkplain ResolverStyle#LENIENT lenient mode} no validation occurs. */ public static final TemporalField RATA_DIE = Field.RATA_DIE; @@ -232,6 +248,11 @@ } @Override + public boolean isDateBased() { + return true; + } + + @Override public ValueRange range() { return range; } @@ -266,8 +287,15 @@ //----------------------------------------------------------------------- @Override - public Map resolve(TemporalAccessor temporal, long value) { - return Collections.singletonMap(EPOCH_DAY, Math.subtractExact(value, offset)); + public Map resolve(TemporalAccessor temporal, long value, ResolverStyle resolverStyle) { + long epochDay; + if (resolverStyle == ResolverStyle.LENIENT) { + epochDay = Math.subtractExact(value, offset); + } else { + range().checkValidValue(value, this); + epochDay = value - offset; + } + return Collections.singletonMap(EPOCH_DAY, epochDay); } //-----------------------------------------------------------------------