ICU-9019 fix copyright date

X-SVN-Rev: 31487
This commit is contained in:
Steven R. Loomis 2012-02-22 23:15:25 +00:00
parent aad3d090d4
commit a78862686b
2 changed files with 30 additions and 3 deletions

View file

@ -3082,8 +3082,16 @@ public abstract class Calendar implements Serializable, Cloneable, Comparable<Ca
case EXTENDED_YEAR:
case YEAR_WOY:
case MONTH:
set(field, get(field) + amount);
pinField(DAY_OF_MONTH);
{
boolean oldLenient = isLenient();
setLenient(true);
set(field, get(field) + amount);
pinField(DAY_OF_MONTH);
if(oldLenient==false) {
complete();
setLenient(oldLenient);
}
}
return;
case WEEK_OF_YEAR:

View file

@ -1,6 +1,6 @@
/**
*******************************************************************************
* Copyright (C) 2000-2011, International Business Machines Corporation and *
* Copyright (C) 2000-2012, International Business Machines Corporation and *
* others. All Rights Reserved. *
*******************************************************************************
*/
@ -2242,6 +2242,25 @@ public class CalendarRegression extends com.ibm.icu.dev.test.TestFmwk {
errln("FAIL: Max week in 2009 in ISO calendar is 53, but got " + maxWeeks);
}
}
/**
* Test case for ticket:9019
*/
public void Test9019() {
GregorianCalendar cal1 = new GregorianCalendar(TimeZone.GMT_ZONE,ULocale.US);
GregorianCalendar cal2 = new GregorianCalendar(TimeZone.GMT_ZONE,ULocale.US);
cal1.clear();
cal2.clear();
cal1.set(2011,Calendar.MAY,06);
cal2.set(2012,Calendar.JANUARY,06);
cal1.setLenient(false);
cal1.add(Calendar.MONTH, 8);
if(!cal1.getTime().equals(cal2.getTime())) {
errln("Error: Calendar is " + cal1.getTime() + " but expected " + cal2.getTime());
} else {
logln("Pass: rolled calendar is " + cal1.getTime());
}
}
}
//eof