--- a/jdk/make/sun/awt/Makefile Mon Dec 13 16:21:36 2010 -0800
+++ b/jdk/make/sun/awt/Makefile Mon Dec 13 16:22:29 2010 -0800
@@ -366,11 +366,12 @@
fontconfig.properties \
fontconfig.RedHat.properties \
fontconfig.RedHat.2.1.properties \
- fontconfig.RedHat.3.properties \
+ fontconfig.RedHat.3.properties \
fontconfig.RedHat.4.properties \
fontconfig.Sun.properties \
fontconfig.Turbo.properties \
- fontconfig.SuSE.properties
+ fontconfig.SuSE.10.properties \
+ fontconfig.SuSE.11.properties
endif
FONTCONFIGS_SRC_PREFIX = $(PLATFORM).
--- a/jdk/src/share/classes/java/awt/Dialog.java Mon Dec 13 16:21:36 2010 -0800
+++ b/jdk/src/share/classes/java/awt/Dialog.java Mon Dec 13 16:22:29 2010 -0800
@@ -565,7 +565,7 @@
* @since 1.6
*/
public Dialog(Window owner) {
- this(owner, null, ModalityType.MODELESS);
+ this(owner, "", ModalityType.MODELESS);
}
/**
@@ -624,7 +624,7 @@
* @since 1.6
*/
public Dialog(Window owner, ModalityType modalityType) {
- this(owner, null, modalityType);
+ this(owner, "", modalityType);
}
/**
--- a/jdk/src/share/classes/java/lang/Character.java Mon Dec 13 16:21:36 2010 -0800
+++ b/jdk/src/share/classes/java/lang/Character.java Mon Dec 13 16:22:29 2010 -0800
@@ -6371,15 +6371,15 @@
* This method returns <code>true</code> for the following five
* characters only:
* <table>
- * <tr><td><code>'\t'</code></td> <td><code>'\u0009'</code></td>
+ * <tr><td><code>'\t'</code></td> <td><code>U+0009</code></td>
* <td><code>HORIZONTAL TABULATION</code></td></tr>
- * <tr><td><code>'\n'</code></td> <td><code>'\u000A'</code></td>
+ * <tr><td><code>'\n'</code></td> <td><code>U+000A</code></td>
* <td><code>NEW LINE</code></td></tr>
- * <tr><td><code>'\f'</code></td> <td><code>'\u000C'</code></td>
+ * <tr><td><code>'\f'</code></td> <td><code>U+000C</code></td>
* <td><code>FORM FEED</code></td></tr>
- * <tr><td><code>'\r'</code></td> <td><code>'\u000D'</code></td>
+ * <tr><td><code>'\r'</code></td> <td><code>U+000D</code></td>
* <td><code>CARRIAGE RETURN</code></td></tr>
- * <tr><td><code>' '</code></td> <td><code>'\u0020'</code></td>
+ * <tr><td><code>' '</code></td> <td><code>U+0020</code></td>
* <td><code>SPACE</code></td></tr>
* </table>
*
@@ -6463,15 +6463,15 @@
* <code>LINE_SEPARATOR</code>, or <code>PARAGRAPH_SEPARATOR</code>)
* but is not also a non-breaking space (<code>'\u00A0'</code>,
* <code>'\u2007'</code>, <code>'\u202F'</code>).
- * <li> It is <code>'\u0009'</code>, HORIZONTAL TABULATION.
- * <li> It is <code>'\u000A'</code>, LINE FEED.
- * <li> It is <code>'\u000B'</code>, VERTICAL TABULATION.
- * <li> It is <code>'\u000C'</code>, FORM FEED.
- * <li> It is <code>'\u000D'</code>, CARRIAGE RETURN.
- * <li> It is <code>'\u001C'</code>, FILE SEPARATOR.
- * <li> It is <code>'\u001D'</code>, GROUP SEPARATOR.
- * <li> It is <code>'\u001E'</code>, RECORD SEPARATOR.
- * <li> It is <code>'\u001F'</code>, UNIT SEPARATOR.
+ * <li> It is <code>'\t'</code>, U+0009 HORIZONTAL TABULATION.
+ * <li> It is <code>'\n'</code>, U+000A LINE FEED.
+ * <li> It is <code>'\u000B'</code>, U+000B VERTICAL TABULATION.
+ * <li> It is <code>'\f'</code>, U+000C FORM FEED.
+ * <li> It is <code>'\r'</code>, U+000D CARRIAGE RETURN.
+ * <li> It is <code>'\u001C'</code>, U+001C FILE SEPARATOR.
+ * <li> It is <code>'\u001D'</code>, U+001D GROUP SEPARATOR.
+ * <li> It is <code>'\u001E'</code>, U+001E RECORD SEPARATOR.
+ * <li> It is <code>'\u001F'</code>, U+001F UNIT SEPARATOR.
* </ul>
*
* <p><b>Note:</b> This method cannot handle <a
@@ -6499,15 +6499,15 @@
* {@link #LINE_SEPARATOR}, or {@link #PARAGRAPH_SEPARATOR})
* but is not also a non-breaking space (<code>'\u00A0'</code>,
* <code>'\u2007'</code>, <code>'\u202F'</code>).
- * <li> It is <code>'\u0009'</code>, HORIZONTAL TABULATION.
- * <li> It is <code>'\u000A'</code>, LINE FEED.
- * <li> It is <code>'\u000B'</code>, VERTICAL TABULATION.
- * <li> It is <code>'\u000C'</code>, FORM FEED.
- * <li> It is <code>'\u000D'</code>, CARRIAGE RETURN.
- * <li> It is <code>'\u001C'</code>, FILE SEPARATOR.
- * <li> It is <code>'\u001D'</code>, GROUP SEPARATOR.
- * <li> It is <code>'\u001E'</code>, RECORD SEPARATOR.
- * <li> It is <code>'\u001F'</code>, UNIT SEPARATOR.
+ * <li> It is <code>'\t'</code>, U+0009 HORIZONTAL TABULATION.
+ * <li> It is <code>'\n'</code>, U+000A LINE FEED.
+ * <li> It is <code>'\u000B'</code>, U+000B VERTICAL TABULATION.
+ * <li> It is <code>'\f'</code>, U+000C FORM FEED.
+ * <li> It is <code>'\r'</code>, U+000D CARRIAGE RETURN.
+ * <li> It is <code>'\u001C'</code>, U+001C FILE SEPARATOR.
+ * <li> It is <code>'\u001D'</code>, U+001D GROUP SEPARATOR.
+ * <li> It is <code>'\u001E'</code>, U+001E RECORD SEPARATOR.
+ * <li> It is <code>'\u001F'</code>, U+001F UNIT SEPARATOR.
* </ul>
* <p>
*
--- a/jdk/src/share/classes/java/text/AttributedCharacterIterator.java Mon Dec 13 16:21:36 2010 -0800
+++ b/jdk/src/share/classes/java/text/AttributedCharacterIterator.java Mon Dec 13 16:22:29 2010 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
import java.util.Set;
/**
- * An AttributedCharacterIterator allows iteration through both text and
+ * An {@code AttributedCharacterIterator} allows iteration through both text and
* related attribute information.
*
* <p>
@@ -46,22 +46,28 @@
* <p>A <em>run with respect to an attribute</em> is a maximum text range for
* which:
* <ul>
- * <li>the attribute is undefined or null for the entire range, or
- * <li>the attribute value is defined and has the same non-null value for the
+ * <li>the attribute is undefined or {@code null} for the entire range, or
+ * <li>the attribute value is defined and has the same non-{@code null} value for the
* entire range.
* </ul>
*
* <p>A <em>run with respect to a set of attributes</em> is a maximum text range for
* which this condition is met for each member attribute.
*
+ * <p>When getting a run with no explicit attributes specified (i.e.,
+ * calling {@link #getRunStart()} and {@link #getRunLimit()}), any
+ * contiguous text segments having the same attributes (the same set
+ * of attribute/value pairs) are treated as separate runs if the
+ * attributes have been given to those text segments separately.
+ *
* <p>The returned indexes are limited to the range of the iterator.
*
* <p>The returned attribute information is limited to runs that contain
* the current character.
*
* <p>
- * Attribute keys are instances of AttributedCharacterIterator.Attribute and its
- * subclasses, such as java.awt.font.TextAttribute.
+ * Attribute keys are instances of {@link AttributedCharacterIterator.Attribute} and its
+ * subclasses, such as {@link java.awt.font.TextAttribute}.
*
* @see AttributedCharacterIterator.Attribute
* @see java.awt.font.TextAttribute
@@ -74,7 +80,7 @@
/**
* Defines attribute keys that are used to identify text attributes. These
- * keys are used in AttributedCharacterIterator and AttributedString.
+ * keys are used in {@code AttributedCharacterIterator} and {@code AttributedString}.
* @see AttributedCharacterIterator
* @see AttributedString
* @since 1.2
@@ -83,7 +89,7 @@
public static class Attribute implements Serializable {
/**
- * The name of this Attribute. The name is used primarily by readResolve
+ * The name of this {@code Attribute}. The name is used primarily by {@code readResolve}
* to look up the corresponding predefined instance when deserializing
* an instance.
* @serial
@@ -94,7 +100,7 @@
private static final Map instanceMap = new HashMap(7);
/**
- * Constructs an Attribute with the given name.
+ * Constructs an {@code Attribute} with the given name.
*/
protected Attribute(String name) {
this.name = name;
@@ -114,7 +120,7 @@
/**
* Returns a hash code value for the object. This version is identical to
- * the one in Object, but is also final.
+ * the one in {@code Object}, but is also final.
*/
public final int hashCode() {
return super.hashCode();
@@ -122,7 +128,8 @@
/**
* Returns a string representation of the object. This version returns the
- * concatenation of class name, "(", a name identifying the attribute and ")".
+ * concatenation of class name, {@code "("}, a name identifying the attribute
+ * and {@code ")"}.
*/
public String toString() {
return getClass().getName() + "(" + name + ")";
@@ -153,7 +160,7 @@
/**
* Attribute key for the language of some text.
- * <p> Values are instances of Locale.
+ * <p> Values are instances of {@link java.util.Locale Locale}.
* @see java.util.Locale
*/
public static final Attribute LANGUAGE = new Attribute("language");
@@ -163,7 +170,7 @@
* and the pronunciation of a word are only loosely related (such as Japanese),
* it is often necessary to store the reading (pronunciation) along with the
* written form.
- * <p>Values are instances of Annotation holding instances of String.
+ * <p>Values are instances of {@link Annotation} holding instances of {@link String}.
* @see Annotation
* @see java.lang.String
*/
@@ -172,7 +179,7 @@
/**
* Attribute key for input method segments. Input methods often break
* up text into segments, which usually correspond to words.
- * <p>Values are instances of Annotation holding a null reference.
+ * <p>Values are instances of {@link Annotation} holding a {@code null} reference.
* @see Annotation
*/
public static final Attribute INPUT_METHOD_SEGMENT = new Attribute("input_method_segment");
@@ -185,36 +192,44 @@
/**
* Returns the index of the first character of the run
* with respect to all attributes containing the current character.
+ *
+ * <p>Any contiguous text segments having the same attributes (the
+ * same set of attribute/value pairs) are treated as separate runs
+ * if the attributes have been given to those text segments separately.
*/
public int getRunStart();
/**
* Returns the index of the first character of the run
- * with respect to the given attribute containing the current character.
+ * with respect to the given {@code attribute} containing the current character.
*/
public int getRunStart(Attribute attribute);
/**
* Returns the index of the first character of the run
- * with respect to the given attributes containing the current character.
+ * with respect to the given {@code attributes} containing the current character.
*/
public int getRunStart(Set<? extends Attribute> attributes);
/**
* Returns the index of the first character following the run
* with respect to all attributes containing the current character.
+ *
+ * <p>Any contiguous text segments having the same attributes (the
+ * same set of attribute/value pairs) are treated as separate runs
+ * if the attributes have been given to those text segments separately.
*/
public int getRunLimit();
/**
* Returns the index of the first character following the run
- * with respect to the given attribute containing the current character.
+ * with respect to the given {@code attribute} containing the current character.
*/
public int getRunLimit(Attribute attribute);
/**
* Returns the index of the first character following the run
- * with respect to the given attributes containing the current character.
+ * with respect to the given {@code attributes} containing the current character.
*/
public int getRunLimit(Set<? extends Attribute> attributes);
@@ -225,9 +240,8 @@
public Map<Attribute,Object> getAttributes();
/**
- * Returns the value of the named attribute for the current character.
- * Returns null if the attribute is not defined.
- * @param attribute the key of the attribute whose value is requested.
+ * Returns the value of the named {@code attribute} for the current character.
+ * Returns {@code null} if the {@code attribute} is not defined.
*/
public Object getAttribute(Attribute attribute);
--- a/jdk/src/share/classes/java/text/CollationElementIterator.java Mon Dec 13 16:21:36 2010 -0800
+++ b/jdk/src/share/classes/java/text/CollationElementIterator.java Mon Dec 13 16:22:29 2010 -0800
@@ -79,9 +79,13 @@
* <pre>
*
* String testString = "This is a test";
- * RuleBasedCollator ruleBasedCollator = (RuleBasedCollator)Collator.getInstance();
- * CollationElementIterator collationElementIterator = ruleBasedCollator.getCollationElementIterator(testString);
- * int primaryOrder = CollationElementIterator.primaryOrder(collationElementIterator.next());
+ * Collator col = Collator.getInstance();
+ * if (col instanceof RuleBasedCollator) {
+ * RuleBasedCollator ruleBasedCollator = (RuleBasedCollator)col;
+ * CollationElementIterator collationElementIterator = ruleBasedCollator.getCollationElementIterator(testString);
+ * int primaryOrder = CollationElementIterator.primaryOrder(collationElementIterator.next());
+ * :
+ * }
* </pre>
* </blockquote>
*
@@ -93,6 +97,10 @@
* is its primary order; the next 8 bits is the secondary order and the
* last 8 bits is the tertiary order.
*
+ * <p><b>Note:</b> <code>CollationElementIterator</code> is a part of
+ * <code>RuleBasedCollator</code> implementation. It is only usable
+ * with <code>RuleBasedCollator</code> instances.
+ *
* @see Collator
* @see RuleBasedCollator
* @author Helena Shih, Laura Werner, Richard Gillam
--- a/jdk/src/share/classes/java/text/RuleBasedCollator.java Mon Dec 13 16:21:36 2010 -0800
+++ b/jdk/src/share/classes/java/text/RuleBasedCollator.java Mon Dec 13 16:22:29 2010 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -180,11 +180,15 @@
*
* <p><strong>Examples</strong>
* <p>Simple: "< a < b < c < d"
- * <p>Norwegian: "< a,A< b,B< c,C< d,D< e,E< f,F< g,G< h,H< i,I< j,J
- * < k,K< l,L< m,M< n,N< o,O< p,P< q,Q< r,R< s,S< t,T
- * < u,U< v,V< w,W< x,X< y,Y< z,Z
- * < \u00E5=a\u030A,\u00C5=A\u030A
- * ;aa,AA< \u00E6,\u00C6< \u00F8,\u00D8"
+ * <p>Norwegian: "< a, A < b, B < c, C < d, D < e, E < f, F
+ * < g, G < h, H < i, I < j, J < k, K < l, L
+ * < m, M < n, N < o, O < p, P < q, Q < r, R
+ * < s, S < t, T < u, U < v, V < w, W < x, X
+ * < y, Y < z, Z
+ * < \u00E6, \u00C6
+ * < \u00F8, \u00D8
+ * < \u00E5 = a\u030A, \u00C5 = A\u030A;
+ * aa, AA"
*
* <p>
* To create a <code>RuleBasedCollator</code> object with specialized
@@ -199,11 +203,14 @@
* Or:
* <blockquote>
* <pre>
- * String Norwegian = "< a,A< b,B< c,C< d,D< e,E< f,F< g,G< h,H< i,I< j,J" +
- * "< k,K< l,L< m,M< n,N< o,O< p,P< q,Q< r,R< s,S< t,T" +
- * "< u,U< v,V< w,W< x,X< y,Y< z,Z" +
- * "< \u00E5=a\u030A,\u00C5=A\u030A" +
- * ";aa,AA< \u00E6,\u00C6< \u00F8,\u00D8";
+ * String Norwegian = "< a, A < b, B < c, C < d, D < e, E < f, F < g, G < h, H < i, I" +
+ * "< j, J < k, K < l, L < m, M < n, N < o, O < p, P < q, Q < r, R" +
+ * "< s, S < t, T < u, U < v, V < w, W < x, X < y, Y < z, Z" +
+ * "< \u00E6, \u00C6" + // Latin letter ae & AE
+ * "< \u00F8, \u00D8" + // Latin letter o & O with stroke
+ * "< \u00E5 = a\u030A," + // Latin letter a with ring above
+ * " \u00C5 = A\u030A;" + // Latin letter A with ring above
+ * " aa, AA";
* RuleBasedCollator myNorwegian = new RuleBasedCollator(Norwegian);
* </pre>
* </blockquote>
--- a/jdk/src/share/classes/java/text/SimpleDateFormat.java Mon Dec 13 16:21:36 2010 -0800
+++ b/jdk/src/share/classes/java/text/SimpleDateFormat.java Mon Dec 13 16:22:29 2010 -0800
@@ -1839,8 +1839,15 @@
break parsing;
case PATTERN_HOUR_OF_DAY1: // 'k' 1-based. eg, 23:59 + 1 hour =>> 24:59
+ if (!isLenient()) {
+ // Validate the hour value in non-lenient
+ if (value < 1 || value > 24) {
+ break parsing;
+ }
+ }
// [We computed 'value' above.]
- if (value == calendar.getMaximum(Calendar.HOUR_OF_DAY)+1) value = 0;
+ if (value == calendar.getMaximum(Calendar.HOUR_OF_DAY)+1)
+ value = 0;
calb.set(Calendar.HOUR_OF_DAY, value);
return pos.index;
@@ -1886,8 +1893,15 @@
break parsing;
case PATTERN_HOUR1: // 'h' 1-based. eg, 11PM + 1 hour =>> 12 AM
+ if (!isLenient()) {
+ // Validate the hour value in non-lenient
+ if (value < 1 || value > 12) {
+ break parsing;
+ }
+ }
// [We computed 'value' above.]
- if (value == calendar.getLeastMaximum(Calendar.HOUR)+1) value = 0;
+ if (value == calendar.getLeastMaximum(Calendar.HOUR)+1)
+ value = 0;
calb.set(Calendar.HOUR, value);
return pos.index;
--- a/jdk/src/share/classes/java/util/ListResourceBundle.java Mon Dec 13 16:21:36 2010 -0800
+++ b/jdk/src/share/classes/java/util/ListResourceBundle.java Mon Dec 13 16:22:29 2010 -0800
@@ -72,7 +72,7 @@
*
* public class MyResources extends ListResourceBundle {
* protected Object[][] getContents() {
- * return new Object[][] = {
+ * return new Object[][] {
* // LOCALIZE THIS
* {"s1", "The disk \"{1}\" contains {0}."}, // MessageFormat pattern
* {"s2", "1"}, // location of {0} in pattern
--- a/jdk/src/share/classes/java/util/Locale.java Mon Dec 13 16:21:36 2010 -0800
+++ b/jdk/src/share/classes/java/util/Locale.java Mon Dec 13 16:22:29 2010 -0800
@@ -870,7 +870,7 @@
* @throws SecurityException - if a security manager exists and its
* checkPermission method doesn't allow the operation.
* @throws NullPointerException - if category and/or newLocale is null
- * @see SecurityManager.checkPermission(java.security.Permission)
+ * @see SecurityManager#checkPermission(java.security.Permission)
* @see PropertyPermission
* @see #getDefault(Locale.Category)
* @since 1.7
@@ -1232,20 +1232,18 @@
* "Solaris_isjustthecoolestthing" is emitted as
* "x-lvariant-Solaris", not as "solaris".</li></ul>
*
- * <p><b>Compatibility special cases:</b><ul>
+ * <p><b>Special Conversions:</b> Java supports some old locale
+ * representations, including deprecated ISO language codes,
+ * for compatibility. This method performs the following
+ * conversions:
+ * <ul>
*
- * <li>The language codes "iw", "ji", and "in" are handled
- * specially. Java uses these deprecated codes for compatibility
- * reasons. The <code>toLanguageTag</code> method converts these
- * three codes (and only these three) to "he", "yi", and "id"
- * respectively.
+ * <li>Deprecated ISO language codes "iw", "ji", and "in" are
+ * converted to "he", "yi", and "id", respectively.
*
* <li>A locale with language "no", country "NO", and variant
- * "NY", representing Norwegian Nynorsk, will be represented as
- * having language "nn", country "NO", and empty variant. This is
- * because some JVMs used the deprecated form to represent the
- * user's default locale, and for compatibility reasons that Take a has
- * not been changed.</ul>
+ * "NY", representing Norwegian Nynorsk (Norway), is converted
+ * to a language tag "nn-NO".</li></ul>
*
* <p><b>Note:</b> Although the language tag created by this
* method is well-formed (satisfies the syntax requirements
@@ -1327,7 +1325,7 @@
*
* <pre>
* Locale loc;
- * loc = Locale.forLanguageTag("en-US-x-lvariant-POSIX);
+ * loc = Locale.forLanguageTag("en-US-x-lvariant-POSIX");
* loc.getVariant(); // returns "POSIX"
* loc.getExtension('x'); // returns null
*
@@ -1355,10 +1353,10 @@
* extensions are added as though the constructor had been called:
*
* <pre>
- * Locale.forLanguageTag("ja-JP-x-lvariant-JP).toLanguageTag();
- * // returns ja-JP-u-ca-japanese-x-lvariant-JP
- * Locale.forLanguageTag("th-TH-x-lvariant-TH).toLanguageTag();
- * // returns th-TH-u-nu-thai-x-lvariant-TH
+ * Locale.forLanguageTag("ja-JP-x-lvariant-JP").toLanguageTag();
+ * // returns "ja-JP-u-ca-japanese-x-lvariant-JP"
+ * Locale.forLanguageTag("th-TH-x-lvariant-TH").toLanguageTag();
+ * // returns "th-TH-u-nu-thai-x-lvariant-TH"
* <pre></ul>
*
* <p>This implements the 'Language-Tag' production of BCP47, and
@@ -1428,7 +1426,12 @@
LanguageTag tag = LanguageTag.parse(languageTag, null);
InternalLocaleBuilder bldr = new InternalLocaleBuilder();
bldr.setLanguageTag(tag);
- return getInstance(bldr.getBaseLocale(), bldr.getLocaleExtensions());
+ BaseLocale base = bldr.getBaseLocale();
+ LocaleExtensions exts = bldr.getLocaleExtensions();
+ if (exts.isEmpty() && base.getVariant().length() > 0) {
+ exts = getCompatibilityExtensions(base.getLanguage(), base.getScript(), base.getRegion(), base.getVariant());
+ }
+ return getInstance(base, exts);
}
/**
@@ -2487,6 +2490,10 @@
public Locale build() {
BaseLocale baseloc = _locbld.getBaseLocale();
LocaleExtensions extensions = _locbld.getLocaleExtensions();
+ if (extensions.isEmpty() && baseloc.getVariant().length() > 0) {
+ extensions = getCompatibilityExtensions(baseloc.getLanguage(), baseloc.getScript(),
+ baseloc.getRegion(), baseloc.getVariant());
+ }
return Locale.getInstance(baseloc, extensions);
}
}
--- a/jdk/src/share/classes/javax/swing/JDialog.java Mon Dec 13 16:21:36 2010 -0800
+++ b/jdk/src/share/classes/javax/swing/JDialog.java Mon Dec 13 16:22:29 2010 -0800
@@ -154,8 +154,8 @@
}
/**
- * Creates a modeless dialog without a title with the
- * specified {@code Frame} as its owner. If {@code owner}
+ * Creates a modeless dialog with the specified {@code Frame}
+ * as its owner and an empty title. If {@code owner}
* is {@code null}, a shared, hidden frame will be set as the
* owner of the dialog.
* <p>
@@ -179,8 +179,8 @@
}
/**
- * Creates a dialog with the specified owner {@code Frame}, modality
- * and an empty title. If {@code owner} is {@code null},
+ * Creates a dialog with an empty title and the specified modality and
+ * {@code Frame} as its owner. If {@code owner} is {@code null},
* a shared, hidden frame will be set as the owner of the dialog.
* <p>
* This constructor sets the component's locale property to the value
@@ -202,7 +202,7 @@
* @see JComponent#getDefaultLocale
*/
public JDialog(Frame owner, boolean modal) {
- this(owner, null, modal);
+ this(owner, "", modal);
}
/**
@@ -330,8 +330,8 @@
}
/**
- * Creates a modeless dialog without a title with the
- * specified {@code Dialog} as its owner.
+ * Creates a modeless dialog with the specified {@code Dialog}
+ * as its owner and an empty title.
* <p>
* This constructor sets the component's locale property to the value
* returned by {@code JComponent.getDefaultLocale}.
@@ -348,7 +348,8 @@
}
/**
- * Creates a dialog with the specified owner {@code Dialog} and modality.
+ * Creates a dialog with an empty title and the specified modality and
+ * {@code Dialog} as its owner.
* <p>
* This constructor sets the component's locale property to the value
* returned by {@code JComponent.getDefaultLocale}.
@@ -369,7 +370,7 @@
* @see JComponent#getDefaultLocale
*/
public JDialog(Dialog owner, boolean modal) {
- this(owner, null, modal);
+ this(owner, "", modal);
}
/**
@@ -461,8 +462,8 @@
}
/**
- * Creates a modeless dialog with the specified owner {@code Window} and
- * an empty title.
+ * Creates a modeless dialog with the specified {@code Window}
+ * as its owner and an empty title.
* <p>
* This constructor sets the component's locale property to the value
* returned by {@code JComponent.getDefaultLocale}.
@@ -488,8 +489,8 @@
}
/**
- * Creates a dialog with the specified owner {@code Window}, modality
- * and an empty title.
+ * Creates a dialog with an empty title and the specified modality and
+ * {@code Window} as its owner.
* <p>
* This constructor sets the component's locale property to the value
* returned by {@code JComponent.getDefaultLocale}.
@@ -520,7 +521,7 @@
* @since 1.6
*/
public JDialog(Window owner, ModalityType modalityType) {
- this(owner, null, modalityType);
+ this(owner, "", modalityType);
}
/**
--- a/jdk/src/share/classes/sun/util/BuddhistCalendar.java Mon Dec 13 16:21:36 2010 -0800
+++ b/jdk/src/share/classes/sun/util/BuddhistCalendar.java Mon Dec 13 16:22:29 2010 -0800
@@ -25,6 +25,8 @@
package sun.util;
+import java.io.IOException;
+import java.io.ObjectInputStream;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashMap;
@@ -42,7 +44,7 @@
private static final long serialVersionUID = -8527488697350388578L;
- private static final int buddhistOffset = 543;
+ private static final int BUDDHIST_YEAR_OFFSET = 543;
///////////////
// Constructors
@@ -103,7 +105,7 @@
* Generates the hash code for the BuddhistCalendar object
*/
public int hashCode() {
- return super.hashCode() ^ buddhistOffset;
+ return super.hashCode() ^ BUDDHIST_YEAR_OFFSET;
}
/**
@@ -141,6 +143,8 @@
public void add(int field, int amount)
{
int savedYearOffset = yearOffset;
+ // To let the superclass calculate date-time values correctly,
+ // temporarily make this GregorianCalendar.
yearOffset = 0;
try {
super.add(field, amount);
@@ -159,6 +163,8 @@
public void roll(int field, int amount)
{
int savedYearOffset = yearOffset;
+ // To let the superclass calculate date-time values correctly,
+ // temporarily make this GregorianCalendar.
yearOffset = 0;
try {
super.roll(field, amount);
@@ -246,6 +252,8 @@
*/
public int getActualMaximum(int field) {
int savedYearOffset = yearOffset;
+ // To let the superclass calculate date-time values correctly,
+ // temporarily make this GregorianCalendar.
yearOffset = 0;
try {
return super.getActualMaximum(field);
@@ -275,11 +283,16 @@
// Skip the year number
while (Character.isDigit(s.charAt(p++)))
;
- int year = internalGet(YEAR) + buddhistOffset;
+ int year = internalGet(YEAR) + BUDDHIST_YEAR_OFFSET;
sb.append(year).append(s.substring(p - 1));
return sb.toString();
}
- private transient int yearOffset = buddhistOffset;
+ private transient int yearOffset = BUDDHIST_YEAR_OFFSET;
+ private void readObject(ObjectInputStream stream)
+ throws IOException, ClassNotFoundException {
+ stream.defaultReadObject();
+ yearOffset = BUDDHIST_YEAR_OFFSET;
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/text/Format/DateFormat/Bug4396385.java Mon Dec 13 16:22:29 2010 -0800
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 4396385
+ * @summary Make sure to detect invalid values for 1-based hour formats.
+ */
+
+import java.text.*;
+import java.util.*;
+
+public class Bug4396385 {
+ private static int errorCount = 0;
+ private static String[][] data = {
+ { "hh:mma", "-1:30AM" },
+ { "hh:mma", "00:30AM" },
+ { "hh:mma", "13:30AM" },
+ { "kk:mm", "-1:12" },
+ { "kk:mm", "00:12" },
+ { "kk:mm", "25:12" },
+ };
+
+ public static void main(String[] args) {
+ TimeZone tz = TimeZone.getDefault();
+ // Use "GMT" to avoid any surprises related to offset
+ // transitions.
+ TimeZone.setDefault(TimeZone.getTimeZone("GMT"));
+
+ try {
+ for (String[] item : data) {
+ test(item[0], item[1]);
+ }
+ } finally {
+ // Restore the default time zone
+ TimeZone.setDefault(tz);
+ }
+
+ if (errorCount > 0) {
+ throw new RuntimeException("Failed with " + errorCount + " error(s).");
+ }
+ }
+
+ private static void test(String pattern, String src) {
+ SimpleDateFormat sdf = new SimpleDateFormat(pattern, Locale.US);
+ sdf.setLenient(false);
+ ParsePosition pos = new ParsePosition(0);
+ System.out.printf("parse: \"%s\" with \"%s\"", src, pattern);
+ Date date = sdf.parse(src, pos);
+ System.out.printf(": date = %s, errorIndex = %d", date, pos.getErrorIndex());
+ if (date != null || pos.getErrorIndex() == -1) {
+ System.out.println(": failed");
+ errorCount++;
+ } else {
+ System.out.println(": passed");
+ }
+ }
+}
--- a/jdk/test/java/util/Locale/LocaleEnhanceTest.java Mon Dec 13 16:21:36 2010 -0800
+++ b/jdk/test/java/util/Locale/LocaleEnhanceTest.java Mon Dec 13 16:22:29 2010 -0800
@@ -1201,6 +1201,49 @@
}
}
+ public void testBug7002320() {
+ // forLanguageTag() and Builder.setLanguageTag(String)
+ // should add a location extension for following two cases.
+ //
+ // 1. language/country are "ja"/"JP" and the resolved variant (x-lvariant-*)
+ // is exactly "JP" and no BCP 47 extensions are available, then add
+ // a Unicode locale extension "ca-japanese".
+ // 2. language/country are "th"/"TH" and the resolved variant is exactly
+ // "TH" and no BCP 47 extensions are available, then add a Unicode locale
+ // extension "nu-thai".
+ //
+ String[][] testdata = {
+ {"ja-JP-x-lvariant-JP", "ja-JP-u-ca-japanese-x-lvariant-JP"}, // special case 1
+ {"ja-JP-x-lvariant-JP-XXX"},
+ {"ja-JP-u-ca-japanese-x-lvariant-JP"},
+ {"ja-JP-u-ca-gregory-x-lvariant-JP"},
+ {"ja-JP-u-cu-jpy-x-lvariant-JP"},
+ {"ja-x-lvariant-JP"},
+ {"th-TH-x-lvariant-TH", "th-TH-u-nu-thai-x-lvariant-TH"}, // special case 2
+ {"th-TH-u-nu-thai-x-lvariant-TH"},
+ {"en-US-x-lvariant-JP"},
+ };
+
+ Builder bldr = new Builder();
+
+ for (String[] data : testdata) {
+ String in = data[0];
+ String expected = (data.length == 1) ? data[0] : data[1];
+
+ // forLanguageTag
+ Locale loc = Locale.forLanguageTag(in);
+ String out = loc.toLanguageTag();
+ assertEquals("Language tag roundtrip by forLanguageTag with input: " + in, expected, out);
+
+ // setLanguageTag
+ bldr.clear();
+ bldr.setLanguageTag(in);
+ loc = bldr.build();
+ out = loc.toLanguageTag();
+ assertEquals("Language tag roundtrip by Builder.setLanguageTag with input: " + in, expected, out);
+ }
+ }
+
///
/// utility asserts
///
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/DataTransfer/6456844/bug6456844.java Mon Dec 13 16:22:29 2010 -0800
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ @bug 6456844
+ @summary Tests that JTextComponent doesn't create drop locations with null bias.
+ @author Shannon Hickey
+*/
+
+import sun.swing.SwingAccessor;
+
+import javax.swing.*;
+import javax.swing.border.EmptyBorder;
+import javax.swing.text.JTextComponent;
+import java.awt.*;
+
+public class bug6456844 {
+
+ public static void main(String[] args) {
+ JEditorPane ep = new JEditorPane();
+ ep.setContentType("text/html");
+ ep.setText("<html><body>abc</body></html>");
+ ep.setBorder(new EmptyBorder(20, 20, 20, 20));
+ ep.setBounds(0, 0, 100, 100);
+
+ JTextComponent.DropLocation location =
+ (JTextComponent.DropLocation) SwingAccessor.getJTextComponentAccessor().dropLocationForPoint(ep,
+ new Point(0, 0));
+
+ if (location.getBias() == null) {
+ throw new RuntimeException("null bias");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JDialog/6639507/bug6639507.java Mon Dec 13 16:22:29 2010 -0800
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ @bug 6639507
+ @summary Title of javax.swing.JDialog is null while spec says it's empty
+ @author Pavel Porvatov
+*/
+import javax.swing.*;
+import java.awt.*;
+
+public class bug6639507 {
+ public static void main(String[] args) {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ assertEmptyTitle(new Dialog((Frame) null), "new Dialog((Frame) null)");
+ assertEmptyTitle(new Dialog((Frame) null, true), "new Dialog((Frame) null, true)");
+ assertEmptyTitle(new Dialog((Dialog) null), "new Dialog((Dialog) null)");
+ assertEmptyTitle(new Dialog((Window) null), "new Dialog((Window) null)");
+ assertEmptyTitle(new Dialog(new Dialog((Window) null), Dialog.ModalityType.APPLICATION_MODAL),
+ "new Dialog((Window) null), Dialog.ModalityType.APPLICATION_MODAL");
+
+ assertEmptyTitle(new JDialog((Frame) null), "new JDialog((Frame) null)");
+ assertEmptyTitle(new JDialog((Frame) null, true), "new JDialog((Frame) null, true)");
+ assertEmptyTitle(new JDialog((Dialog) null), "new JDialog((Dialog) null)");
+ assertEmptyTitle(new JDialog((Dialog) null, true), "new JDialog((Dialog) null, true)");
+ assertEmptyTitle(new JDialog((Window) null), "new JDialog((Window) null)");
+ assertEmptyTitle(new JDialog((Window) null, Dialog.ModalityType.APPLICATION_MODAL),
+ "new JDialog((Window) null, Dialog.ModalityType.APPLICATION_MODAL)");
+ }
+ });
+ }
+
+ private static void assertEmptyTitle(Dialog dialog, String ctr) {
+ String title = dialog.getTitle();
+
+ if (title == null || title.length() > 0) {
+ throw new RuntimeException("Title is not empty for constructor " + ctr);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/util/calendar/Bug6653944.java Mon Dec 13 16:22:29 2010 -0800
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ *@test
+ *@bug 6653944
+ *@summary Deserialization tests for YEAR calculcations
+ */
+
+import java.io.*;
+import java.util.*;
+
+public class Bug6653944 {
+ private static int errorCount = 0;
+
+ public static void main(String[] args) throws Exception {
+ Calendar buddhist = Calendar.getInstance(new Locale("th", "TH"));
+ int expectedYear = buddhist.get(Calendar.YEAR);
+
+ Calendar deserialized = (Calendar) deserialize(serialize(buddhist));
+ compare(deserialized, buddhist);
+
+ int deserializedYear = deserialized.get(Calendar.YEAR);
+ compare(deserializedYear, expectedYear);
+
+ // test add(YEAR, n).
+ buddhist.add(Calendar.YEAR, 12);
+ expectedYear = buddhist.get(Calendar.YEAR);
+ deserialized.add(Calendar.YEAR, 12);
+ deserializedYear = deserialized.get(Calendar.YEAR);
+ compare(deserialized, buddhist);
+ compare(deserializedYear, expectedYear);
+
+ if (errorCount > 0) {
+ throw new RuntimeException("Bug6653944: failed");
+ }
+ }
+
+ private static void compare(int got, int expected) {
+ if (got != expected) {
+ System.err.println("got " + got + ", expected " + expected);
+ errorCount++;
+ }
+ }
+
+ private static void compare(Calendar got, Calendar expected) {
+ if (!got.equals(expected)) {
+ System.err.println("got " + got + ", expected " + expected);
+ errorCount++;
+ }
+ }
+
+ private static byte[] serialize(Serializable obj) throws Exception {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ ObjectOutputStream oos = new ObjectOutputStream(baos);
+ oos.writeObject(obj);
+ oos.close();
+ return baos.toByteArray();
+ }
+
+ private static Object deserialize(byte[] data) throws Exception {
+ ByteArrayInputStream bais = new ByteArrayInputStream(data);
+ ObjectInputStream ois = new ObjectInputStream(bais);
+ return ois.readObject();
+ }
+}