--- old/src/share/classes/java/time/chrono/HijrahChronology.java 2013-07-18 10:20:53.000000000 -0700 +++ new/src/share/classes/java/time/chrono/HijrahChronology.java 2013-07-18 10:20:52.000000000 -0700 @@ -71,8 +71,10 @@ import java.time.Instant; import java.time.LocalDate; import java.time.ZoneId; +import java.time.format.ResolverStyle; import java.time.temporal.ChronoField; import java.time.temporal.TemporalAccessor; +import java.time.temporal.TemporalField; import java.time.temporal.ValueRange; import java.util.Arrays; import java.util.HashMap; @@ -115,7 +117,7 @@ *
* Selecting the chronology from the locale uses {@link Chronology#ofLocale} * to find the Chronology based on Locale supported BCP 47 extension mechanism - * to request a specific calendar ("ca") and variant ("cv"). For example, + * to request a specific calendar ("ca"). For example, *
*- * Locale locale = Locale.forLanguageTag("en-US-u-ca-islamic-cv-umalqura"); + * Locale locale = Locale.forLanguageTag("en-US-u-ca-islamic-umalqura"); * Chronology chrono = Chronology.ofLocale(locale); ** @@ -472,11 +474,16 @@ * @param prolepticYear the proleptic-year * @param dayOfYear the day-of-year * @return the Hijrah local date, not null - * @throws DateTimeException if unable to create the date + * @throws DateTimeException if the value of the year is out of range, + * or if the day-of-year is invalid for the year */ @Override public HijrahDate dateYearDay(int prolepticYear, int dayOfYear) { - return HijrahDate.of(this, prolepticYear, 1, 1).plusDays(dayOfYear - 1); // TODO better + HijrahDate date = HijrahDate.of(this, prolepticYear, 1, 1); + if (dayOfYear > date.lengthOfYear()) { + throw new DateTimeException("Invalid dayOfYear: " + dayOfYear); + } + return date.plusDays(dayOfYear - 1); } /** @@ -515,16 +522,19 @@ } @Override + @SuppressWarnings("unchecked") public ChronoLocalDateTime