changeset 14976:8cc194337a0a

8055900: j.t.SimpleDateFormat spec needs to be clarified regarding month patterns Reviewed-by: okutsu, peytoia
author nishjain
date Thu, 07 Jul 2016 17:53:55 +0900
parents 22617fd44868
children cf7e30f5c03f
files src/java.base/share/classes/java/text/DateFormatSymbols.java src/java.base/share/classes/java/text/SimpleDateFormat.java
diffstat 2 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/java/text/DateFormatSymbols.java	Thu Jul 07 01:31:31 2016 -0700
+++ b/src/java.base/share/classes/java/text/DateFormatSymbols.java	Thu Jul 07 17:53:55 2016 +0900
@@ -418,7 +418,7 @@
      * Gets short month strings. For example: "Jan", "Feb", etc.
      *
      * <p>If the language requires different forms for formatting and
-     * stand-alone usages, This method returns short month names in
+     * stand-alone usages, this method returns short month names in
      * the formatting form. For example, the preferred abbreviation
      * for January in the Catalan language is <em>de gen.</em> in the
      * formatting form, while it is <em>gen.</em> in the stand-alone
--- a/src/java.base/share/classes/java/text/SimpleDateFormat.java	Thu Jul 07 01:31:31 2016 -0700
+++ b/src/java.base/share/classes/java/text/SimpleDateFormat.java	Thu Jul 07 17:53:55 2016 +0900
@@ -276,9 +276,16 @@
  *     it is interpreted as a <a href="#number">number</a>.<br>
  *     <ul>
  *     <li>Letter <em>M</em> produces context-sensitive month names, such as the
- *         embedded form of names. If a {@code DateFormatSymbols} has been set
- *         explicitly with constructor {@link #SimpleDateFormat(String,
- *         DateFormatSymbols)} or method {@link
+ *         embedded form of names. Letter <em>M</em> is context-sensitive in the
+ *         sense that when it is used in the standalone pattern, for example,
+ *         "MMMM", it gives the standalone form of a month name and when it is
+ *         used in the pattern containing other field(s), for example, "d MMMM",
+ *         it gives the format form of a month name. For example, January in the
+ *         Catalan language is "de gener" in the format form while it is "gener"
+ *         in the standalone form. In this case, "MMMM" will produce "gener" and
+ *         the month part of the "d MMMM" will produce "de gener". If a
+ *         {@code DateFormatSymbols} has been set explicitly with constructor
+ *         {@link #SimpleDateFormat(String,DateFormatSymbols)} or method {@link
  *         #setDateFormatSymbols(DateFormatSymbols)}, the month names given by
  *         the {@code DateFormatSymbols} are used.</li>
  *     <li>Letter <em>L</em> produces the standalone form of month names.</li>