From 63f885603291a110798b2b0883a8c949fac026ee Mon Sep 17 00:00:00 2001 From: okutsu Date: Fri, 16 Apr 2010 15:53:18 +0900 Subject: [PATCH] 6609675: [Fmt-Da] DateFormat.parse() on a timezone changes its calendar's timezone Reviewed-by: peytoia --- src/share/classes/java/text/DateFormat.java | 112 +++++++++++++----- .../classes/java/text/SimpleDateFormat.java | 14 +++ 2 files changed, 94 insertions(+), 32 deletions(-) diff --git a/src/share/classes/java/text/DateFormat.java b/src/share/classes/java/text/DateFormat.java index 51a434356..5445678d8 100644 --- a/src/share/classes/java/text/DateFormat.java +++ b/src/share/classes/java/text/DateFormat.java @@ -53,20 +53,20 @@ import java.util.spi.LocaleServiceProvider; import sun.util.LocaleServiceProviderPool; /** - * DateFormat is an abstract class for date/time formatting subclasses which + * {@code DateFormat} is an abstract class for date/time formatting subclasses which * formats and parses dates or time in a language-independent manner. - * The date/time formatting subclass, such as SimpleDateFormat, allows for + * The date/time formatting subclass, such as {@link SimpleDateFormat}, allows for * formatting (i.e., date -> text), parsing (text -> date), and * normalization. The date is represented as a Date object or * as the milliseconds since January 1, 1970, 00:00:00 GMT. * - *

DateFormat provides many class methods for obtaining default date/time + *

{@code DateFormat} provides many class methods for obtaining default date/time * formatters based on the default or a given locale and a number of formatting - * styles. The formatting styles include FULL, LONG, MEDIUM, and SHORT. More + * styles. The formatting styles include {@link #FULL}, {@link #LONG}, {@link #MEDIUM}, and {@link #SHORT}. More * detail and examples of using these styles are provided in the method * descriptions. * - *

DateFormat helps you to format and parse dates for any locale. + *

{@code DateFormat} helps you to format and parse dates for any locale. * Your code can be completely independent of the locale conventions for * months, days of the week, or even the calendar format: lunar vs. solar. * @@ -86,7 +86,7 @@ import sun.util.LocaleServiceProviderPool; * } * *

To format a date for a different Locale, specify it in the - * call to getDateInstance(). + * call to {@link #getDateInstance(int, Locale) getDateInstance()}. *

  *  DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.FRANCE);
  * 
@@ -94,30 +94,30 @@ import sun.util.LocaleServiceProviderPool; *
  *  myDate = df.parse(myString);
  * 
- *

Use getDateInstance to get the normal date format for that country. + *

Use {@code getDateInstance} to get the normal date format for that country. * There are other static factory methods available. - * Use getTimeInstance to get the time format for that country. - * Use getDateTimeInstance to get a date and time format. You can pass in + * Use {@code getTimeInstance} to get the time format for that country. + * Use {@code getDateTimeInstance} to get a date and time format. You can pass in * different options to these factory methods to control the length of the - * result; from SHORT to MEDIUM to LONG to FULL. The exact result depends + * result; from {@link #SHORT} to {@link #MEDIUM} to {@link #LONG} to {@link #FULL}. The exact result depends * on the locale, but generally: - *