diff --git a/.hgtags b/.hgtags
index e1e7ba132b7c7763275a20cac6a31221476c4db3..472ceb8266008e33ace728ff46c3de312fa86680 100644
--- a/.hgtags
+++ b/.hgtags
@@ -134,3 +134,5 @@ f1ec21b8142168ff40f3278d2f6b5fe4bd5f3b26 jdk8-b09
4788745572ef2bde34924ef34e7e4d55ba07e979 jdk8-b10
7ab0d613cd1a271a9763ffb894dc1f0a5b95a7e4 jdk8-b11
09fd2067f715e4505c44b01c301258a4e8f8964e jdk8-b12
+4cb2e8679b27432854690cb688ea06d3b2d8e008 jdk8-b13
+99632935785e2038b2fc836da9f2ede69dea294b jdk8-b14
diff --git a/make/common/Demo.gmk b/make/common/Demo.gmk
index a3788aea7d5f9f2948cd708912d433277220f282..429c4e546c98ee05392fbb30be9ca9349635fbd5 100644
--- a/make/common/Demo.gmk
+++ b/make/common/Demo.gmk
@@ -158,6 +158,8 @@ ifneq ($(strip $(DEMO_ALL_NATIVE_SOURCES)),)
# bit between them.
LINK.demo = $(LINK.c)
LDLIBS.demo = $(EXTRA_LIBS) $(LFLAGS_$(COMPILER_VERSION))
+ DEMO_VERSION_INFO = $(OBJDIR)/$(LIBRARY).res
+ LDLIBS.demo += $(DEMO_VERSION_INFO)
else
ifneq ($(DEMO_NEEDS_CPP),)
LINK.demo = $(LINK.cpp)
@@ -288,6 +290,13 @@ ifndef DEMO_SKIP_SRCZIP
$(install-file)
endif
+ifeq ($(PLATFORM),windows)
+# JDK name required here
+RC_FLAGS += /D "JDK_FNAME=$(LIBRARY).dll" \
+ /D "JDK_INTERNAL_NAME=$(LIBRARY)" \
+ /D "JDK_FTYPE=0x2L"
+endif
+
# Native library building
ifdef DEMO_LIBRARY
@@ -308,6 +317,9 @@ $(OBJDIR)/%.$(OBJECT_SUFFIX): $(DEMO_BUILD_SRCDIR)/%.cpp
# Actual creation of the native shared library (C++ and C are different)
$(DEMO_LIBRARY): $(DEMO_FULL_OBJECTS)
@$(prep-target)
+ ifeq ($(PLATFORM),windows)
+ $(RC) $(RC_FLAGS) $(CC_OBJECT_OUTPUT_FLAG)$(DEMO_VERSION_INFO) $(VERSIONINFO_RESOURCE)
+ endif
$(LINK.demo) $(SHARED_LIBRARY_FLAG) $(CC_PROGRAM_OUTPUT_FLAG)$@ \
$(DEMO_FULL_OBJECTS) $(LDLIBS.demo)
@$(call binary_file_verification,$@)
diff --git a/src/share/classes/com/sun/net/ssl/HttpsURLConnection.java b/src/share/classes/com/sun/net/ssl/HttpsURLConnection.java
index c17fcf72136e02fa8a44b1482e131b7494e54e5d..c60435331ec9becdd9848c2898697524663bb6dc 100644
--- a/src/share/classes/com/sun/net/ssl/HttpsURLConnection.java
+++ b/src/share/classes/com/sun/net/ssl/HttpsURLConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -179,6 +179,12 @@ class HttpsURLConnection extends HttpURLConnection
throw new IllegalArgumentException(
"no SSLSocketFactory specified");
}
+
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkSetFactory();
+ }
+
sslSocketFactory = sf;
}
diff --git a/src/share/classes/java/awt/AWTKeyStroke.java b/src/share/classes/java/awt/AWTKeyStroke.java
index fc311535d652926d06846a7dda5e3258ec4ac47f..13f6edd81f0a77a91fe68c5feef3b8540ef0a516 100644
--- a/src/share/classes/java/awt/AWTKeyStroke.java
+++ b/src/share/classes/java/awt/AWTKeyStroke.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2011, 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
@@ -25,6 +25,7 @@
package java.awt;
import java.awt.event.KeyEvent;
+import sun.awt.AppContext;
import java.awt.event.InputEvent;
import java.util.Collections;
import java.util.HashMap;
@@ -66,9 +67,6 @@ import java.lang.reflect.Field;
public class AWTKeyStroke implements Serializable {
static final long serialVersionUID = -6430539691155161871L;
- private static Map cache;
- private static AWTKeyStroke cacheKey;
- private static Constructor ctor = getCtor(AWTKeyStroke.class);
private static Map modifierKeywords;
/**
* Associates VK_XXX (as a String) with code (as Integer). This is
@@ -77,6 +75,25 @@ public class AWTKeyStroke implements Serializable {
*/
private static VKCollection vks;
+ //A key for the collection of AWTKeyStrokes within AppContext.
+ private static Object APP_CONTEXT_CACHE_KEY = new Object();
+ //A key withing the cache
+ private static AWTKeyStroke APP_CONTEXT_KEYSTROKE_KEY = new AWTKeyStroke();
+
+ /*
+ * Reads keystroke class from AppContext and if null, puts there the
+ * AWTKeyStroke class.
+ * Must be called under locked AWTKeyStro
+ */
+ private static Class getAWTKeyStrokeClass() {
+ Class clazz = (Class)AppContext.getAppContext().get(AWTKeyStroke.class);
+ if (clazz == null) {
+ clazz = AWTKeyStroke.class;
+ AppContext.getAppContext().put(AWTKeyStroke.class, AWTKeyStroke.class);
+ }
+ return clazz;
+ }
+
private char keyChar = KeyEvent.CHAR_UNDEFINED;
private int keyCode = KeyEvent.VK_UNDEFINED;
private int modifiers;
@@ -164,9 +181,12 @@ public class AWTKeyStroke implements Serializable {
if (subclass == null) {
throw new IllegalArgumentException("subclass cannot be null");
}
- if (AWTKeyStroke.ctor.getDeclaringClass().equals(subclass)) {
- // Already registered
- return;
+ synchronized (AWTKeyStroke.class) {
+ Class keyStrokeClass = (Class)AppContext.getAppContext().get(AWTKeyStroke.class);
+ if (keyStrokeClass != null && keyStrokeClass.equals(subclass)){
+ // Already registered
+ return;
+ }
}
if (!AWTKeyStroke.class.isAssignableFrom(subclass)) {
throw new ClassCastException("subclass is not derived from AWTKeyStroke");
@@ -197,9 +217,9 @@ public class AWTKeyStroke implements Serializable {
}
synchronized (AWTKeyStroke.class) {
- AWTKeyStroke.ctor = ctor;
- cache = null;
- cacheKey = null;
+ AppContext.getAppContext().put(AWTKeyStroke.class, subclass);
+ AppContext.getAppContext().remove(APP_CONTEXT_CACHE_KEY);
+ AppContext.getAppContext().remove(APP_CONTEXT_KEYSTROKE_KEY);
}
}
@@ -229,13 +249,19 @@ public class AWTKeyStroke implements Serializable {
private static synchronized AWTKeyStroke getCachedStroke
(char keyChar, int keyCode, int modifiers, boolean onKeyRelease)
{
+ Map cache = (Map)AppContext.getAppContext().get(APP_CONTEXT_CACHE_KEY);
+ AWTKeyStroke cacheKey = (AWTKeyStroke)AppContext.getAppContext().get(APP_CONTEXT_KEYSTROKE_KEY);
+
if (cache == null) {
cache = new HashMap();
+ AppContext.getAppContext().put(APP_CONTEXT_CACHE_KEY, cache);
}
if (cacheKey == null) {
try {
- cacheKey = (AWTKeyStroke)ctor.newInstance((Object[]) null);
+ Class clazz = getAWTKeyStrokeClass();
+ cacheKey = (AWTKeyStroke)getCtor(clazz).newInstance((Object[]) null);
+ AppContext.getAppContext().put(APP_CONTEXT_KEYSTROKE_KEY, cacheKey);
} catch (InstantiationException e) {
assert(false);
} catch (IllegalAccessException e) {
@@ -253,9 +279,8 @@ public class AWTKeyStroke implements Serializable {
if (stroke == null) {
stroke = cacheKey;
cache.put(stroke, stroke);
- cacheKey = null;
+ AppContext.getAppContext().remove(APP_CONTEXT_KEYSTROKE_KEY);
}
-
return stroke;
}
diff --git a/src/share/classes/java/io/InputStream.java b/src/share/classes/java/io/InputStream.java
index 23c166ed67399bed8f2201a63b070721a1d666b5..63d31d51f994bd5b4de5608317d4149d980c9f2d 100644
--- a/src/share/classes/java/io/InputStream.java
+++ b/src/share/classes/java/io/InputStream.java
@@ -44,10 +44,9 @@ package java.io;
*/
public abstract class InputStream implements Closeable {
- // SKIP_BUFFER_SIZE is used to determine the size of skipBuffer
- private static final int SKIP_BUFFER_SIZE = 2048;
- // skipBuffer is initialized in skip(long), if needed.
- private static byte[] skipBuffer;
+ // MAX_SKIP_BUFFER_SIZE is used to determine the maximum buffer size to
+ // use when skipping.
+ private static final int MAX_SKIP_BUFFER_SIZE = 2048;
/**
* Reads the next byte of data from the input stream. The value byte is
@@ -212,18 +211,15 @@ public abstract class InputStream implements Closeable {
long remaining = n;
int nr;
- if (skipBuffer == null)
- skipBuffer = new byte[SKIP_BUFFER_SIZE];
-
- byte[] localSkipBuffer = skipBuffer;
if (n <= 0) {
return 0;
}
+ int size = (int)Math.min(MAX_SKIP_BUFFER_SIZE, remaining);
+ byte[] skipBuffer = new byte[size];
while (remaining > 0) {
- nr = read(localSkipBuffer, 0,
- (int) Math.min(SKIP_BUFFER_SIZE, remaining));
+ nr = read(skipBuffer, 0, (int)Math.min(size, remaining));
if (nr < 0) {
break;
}
diff --git a/src/share/classes/java/util/CurrencyData.properties b/src/share/classes/java/util/CurrencyData.properties
index 5cfc1397e6ed09ab13ca337f32a8fac071b05906..b943993522f24d7c56ff7c8235a3163e6864fe4f 100644
--- a/src/share/classes/java/util/CurrencyData.properties
+++ b/src/share/classes/java/util/CurrencyData.properties
@@ -71,7 +71,7 @@ all=ADP020-AED784-AFA004-AFN971-ALL008-AMD051-ANG532-AOA973-ARS032-ATS040-AUD036
#
# The table is based on the following web sites:
# http://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1/db_en.html
-# http://www.bsi-global.com/iso4217currency
+# http://www.currency-iso.org/iso_index/iso_tables.htm
# http://www.cia.gov/cia/publications/factbook/indexgeo.html
# AFGHANISTAN
@@ -105,7 +105,7 @@ AU=AUD
# AUSTRIA
AT=EUR
# AZERBAIJAN
-AZ=AZM;2005-12-31-20-00-00;AZN
+AZ=AZN
# BAHAMAS
BS=BSD
# BAHRAIN
@@ -378,7 +378,7 @@ MS=XCD
# MOROCCO
MA=MAD
# MOZAMBIQUE
-MZ=MZM;2006-06-30-22-00-00;MZN
+MZ=MZN
# MYANMAR
MM=MMK
# NAMIBIA
@@ -440,7 +440,7 @@ QA=QAR
# REUNION
RE=EUR
# ROMANIA
-RO=ROL;2005-06-30-21-00-00;RON
+RO=RON
# RUSSIAN FEDERATION
RU=RUB
# RWANDA
@@ -532,7 +532,7 @@ TT=TTD
# TUNISIA
TN=TND
# TURKEY
-TR=TRL;2004-12-31-22-00-00;TRY
+TR=TRY
# TURKMENISTAN
TM=TMT
# TURKS AND CAICOS ISLANDS
@@ -558,7 +558,7 @@ UZ=UZS
# VANUATU
VU=VUV
# VENEZUELA
-VE=VEB;2008-01-01-04-00-00;VEF
+VE=VEF
# VIET NAM
VN=VND
# VIRGIN ISLANDS, BRITISH
diff --git a/src/share/classes/javax/net/ssl/HttpsURLConnection.java b/src/share/classes/javax/net/ssl/HttpsURLConnection.java
index fbd8fca13722ecf85a5e0a9446ed817eac4bdab6..5027b9a578824e351b894d79c86634f4bc34c229 100644
--- a/src/share/classes/javax/net/ssl/HttpsURLConnection.java
+++ b/src/share/classes/javax/net/ssl/HttpsURLConnection.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2011, 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
@@ -347,6 +347,9 @@ class HttpsURLConnection extends HttpURLConnection
* @param sf the SSL socket factory
* @throws IllegalArgumentException if the SSLSocketFactory
* parameter is null.
+ * @throws SecurityException if a security manager exists and its
+ * checkSetFactory method does not allow
+ * a socket factory to be specified.
* @see #getSSLSocketFactory()
*/
public void setSSLSocketFactory(SSLSocketFactory sf) {
@@ -355,6 +358,10 @@ class HttpsURLConnection extends HttpURLConnection
"no SSLSocketFactory specified");
}
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkSetFactory();
+ }
sslSocketFactory = sf;
}
diff --git a/src/share/classes/javax/net/ssl/SSLEngine.java b/src/share/classes/javax/net/ssl/SSLEngine.java
index 2eea55121cb6ce401edaacb0fd79e6ab4d135627..411626cd7a13e8ff6abfd8fa1f9fd6407068fd8e 100644
--- a/src/share/classes/javax/net/ssl/SSLEngine.java
+++ b/src/share/classes/javax/net/ssl/SSLEngine.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -538,7 +538,7 @@ public abstract class SSLEngine {
* If this SSLEngine has not yet started its initial
* handshake, this method will automatically start the handshake.
*
- * This method will attempt to produce one SSL/TLS packet, and will
+ * This method will attempt to produce SSL/TLS records, and will
* consume as much source data as possible, but will never consume
* more than the sum of the bytes remaining in each buffer. Each
* ByteBuffer's position is updated to reflect the
diff --git a/src/share/classes/javax/swing/JTable.java b/src/share/classes/javax/swing/JTable.java
index 386b2a4628a244444841a6ff91191ac2d5dd603d..6314cb0a2075266781482c8b7db5d18b636c4a5a 100644
--- a/src/share/classes/javax/swing/JTable.java
+++ b/src/share/classes/javax/swing/JTable.java
@@ -1828,6 +1828,8 @@ public class JTable extends JComponent implements TableModelListener, Scrollable
* table. While the {@code autoCreateRowSorter} property remains
* {@code true}, every time the model is changed, a new {@code
* TableRowSorter} is created and set as the table's row sorter.
+ * The default value for the {@code autoCreateRowSorter}
+ * property is {@code false}.
*
* @param autoCreateRowSorter whether or not a {@code RowSorter}
* should be automatically created
diff --git a/src/share/classes/javax/swing/JTree.java b/src/share/classes/javax/swing/JTree.java
index 13a40562ebe2c2b326f96e0c031d5a68b0a886df..c5ca4b6dc708718b999497c9b8bcb98490655d28 100644
--- a/src/share/classes/javax/swing/JTree.java
+++ b/src/share/classes/javax/swing/JTree.java
@@ -1838,7 +1838,9 @@ public class JTree extends JComponent implements Scrollable, Accessible
* nodes, or null if nothing is currently selected
*/
public TreePath[] getSelectionPaths() {
- return getSelectionModel().getSelectionPaths();
+ TreePath[] selectionPaths = getSelectionModel().getSelectionPaths();
+
+ return (selectionPaths != null && selectionPaths.length > 0) ? selectionPaths : null;
}
/**
diff --git a/src/share/classes/javax/swing/text/DefaultCaret.java b/src/share/classes/javax/swing/text/DefaultCaret.java
index ecbfdf0d6f45e01447a699a3268fa18cf6e1ef1b..464fff6822e549b04b8980957c7a5eadb4911486 100644
--- a/src/share/classes/javax/swing/text/DefaultCaret.java
+++ b/src/share/classes/javax/swing/text/DefaultCaret.java
@@ -1326,7 +1326,7 @@ public class DefaultCaret extends Rectangle implements Caret, FocusListener, Mou
if ( ! SwingUtilities2.canCurrentEventAccessSystemClipboard() ) {
return;
}
- if (this.dot != this.mark && component != null) {
+ if (this.dot != this.mark && component != null && component.hasFocus()) {
Clipboard clip = getSystemSelection();
if (clip != null) {
String selectedText;
diff --git a/src/share/classes/javax/swing/text/html/HTMLDocument.java b/src/share/classes/javax/swing/text/html/HTMLDocument.java
index 5fc8c0f2bf48fd00fd665bd10dfc945a978c9d32..a1f99e9cae8859423daed488d48d8d4cda14e064 100644
--- a/src/share/classes/javax/swing/text/html/HTMLDocument.java
+++ b/src/share/classes/javax/swing/text/html/HTMLDocument.java
@@ -1181,7 +1181,12 @@ public class HTMLDocument extends DefaultStyledDocument {
public void insertAfterStart(Element elem, String htmlText) throws
BadLocationException, IOException {
verifyParser();
- if (elem != null && elem.isLeaf()) {
+
+ if (elem == null || htmlText == null) {
+ return;
+ }
+
+ if (elem.isLeaf()) {
throw new IllegalArgumentException
("Can not insert HTML after start of a leaf");
}
diff --git a/src/share/classes/sun/awt/image/OffScreenImageSource.java b/src/share/classes/sun/awt/image/OffScreenImageSource.java
index 7e8e2dbc795a696a44045f1cc2829e25e7e5f9aa..2b85b6b6d8439ffb201de88aa5618f11833331b5 100644
--- a/src/share/classes/sun/awt/image/OffScreenImageSource.java
+++ b/src/share/classes/sun/awt/image/OffScreenImageSource.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2011, 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
@@ -185,7 +185,7 @@ public class OffScreenImageSource implements ImageProducer {
theConsumer.setDimensions(image.getWidth(), image.getHeight());
theConsumer.setProperties(properties);
sendPixels();
- theConsumer.imageComplete(ImageConsumer.SINGLEFRAMEDONE);
+ theConsumer.imageComplete(ImageConsumer.STATICIMAGEDONE);
} catch (NullPointerException e) {
if (theConsumer != null) {
theConsumer.imageComplete(ImageConsumer.IMAGEERROR);
diff --git a/src/share/classes/sun/net/ResourceManager.java b/src/share/classes/sun/net/ResourceManager.java
index 11bfc46481950da1521c239327084208e424a5aa..068b8484728adf9f94f030cdbee8f827c77254d8 100644
--- a/src/share/classes/sun/net/ResourceManager.java
+++ b/src/share/classes/sun/net/ResourceManager.java
@@ -41,13 +41,14 @@ public class ResourceManager {
/* default maximum number of udp sockets per VM
* when a security manager is enabled.
- * The default is 1024 which is high enough to be useful
+ * The default is 25 which is high enough to be useful
* but low enough to be well below the maximum number
- * of port numbers actually available on all OSes for
- * such sockets (5000 on some versions of windows)
+ * of port numbers actually available on all OSes
+ * when multiplied by the maximum feasible number of VM processes
+ * that could practically be spawned.
*/
- private static final int DEFAULT_MAX_SOCKETS = 1024;
+ private static final int DEFAULT_MAX_SOCKETS = 25;
private static final int maxSockets;
private static final AtomicInteger numSockets;
diff --git a/src/share/classes/sun/print/PSPrinterJob.java b/src/share/classes/sun/print/PSPrinterJob.java
index 722537ea571876c0cfa2b2ae92783d1cb8ae6832..d4a0ffacb202b4b68d7115823a654ab31cd2229b 100644
--- a/src/share/classes/sun/print/PSPrinterJob.java
+++ b/src/share/classes/sun/print/PSPrinterJob.java
@@ -68,14 +68,18 @@ import javax.print.attribute.standard.Sides;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
import java.io.CharConversionException;
import java.io.File;
import java.io.InputStream;
+import java.io.InputStreamReader;
import java.io.IOException;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.OutputStream;
import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Enumeration;
@@ -673,15 +677,38 @@ public class PSPrinterJob extends RasterPrinterJob {
private class PrinterSpooler implements java.security.PrivilegedAction {
PrinterException pex;
+ private void handleProcessFailure(final Process failedProcess,
+ final String[] execCmd, final int result) throws IOException {
+ try (StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw)) {
+ pw.append("error=").append(Integer.toString(result));
+ pw.append(" running:");
+ for (String arg: execCmd) {
+ pw.append(" '").append(arg).append("'");
+ }
+ try (InputStream is = failedProcess.getErrorStream();
+ InputStreamReader isr = new InputStreamReader(is);
+ BufferedReader br = new BufferedReader(isr)) {
+ while (br.ready()) {
+ pw.println();
+ pw.append("\t\t").append(br.readLine());
+ }
+ } finally {
+ pw.flush();
+ throw new IOException(sw.toString());
+ }
+ }
+ }
+
public Object run() {
+ if (spoolFile == null || !spoolFile.exists()) {
+ pex = new PrinterException("No spool file");
+ return null;
+ }
try {
/**
* Spool to the printer.
*/
- if (spoolFile == null || !spoolFile.exists()) {
- pex = new PrinterException("No spool file");
- return null;
- }
String fileName = spoolFile.getAbsolutePath();
String execCmd[] = printExecCmd(mDestination, mOptions,
mNoJobSheet, getJobNameInt(),
@@ -689,12 +716,16 @@ public class PSPrinterJob extends RasterPrinterJob {
Process process = Runtime.getRuntime().exec(execCmd);
process.waitFor();
- spoolFile.delete();
-
+ final int result = process.exitValue();
+ if (0 != result) {
+ handleProcessFailure(process, execCmd, result);
+ }
} catch (IOException ex) {
pex = new PrinterIOException(ex);
} catch (InterruptedException ie) {
pex = new PrinterException(ie.toString());
+ } finally {
+ spoolFile.delete();
}
return null;
}
diff --git a/src/share/classes/sun/rmi/registry/RegistryImpl.java b/src/share/classes/sun/rmi/registry/RegistryImpl.java
index 4878609c088c14d552275a7e57bbced16936a687..db18eb3364dab05f1920d98268198500816ac5fb 100644
--- a/src/share/classes/sun/rmi/registry/RegistryImpl.java
+++ b/src/share/classes/sun/rmi/registry/RegistryImpl.java
@@ -38,13 +38,23 @@ import java.rmi.server.ServerNotActiveException;
import java.rmi.registry.Registry;
import java.rmi.server.RMIClientSocketFactory;
import java.rmi.server.RMIServerSocketFactory;
+import java.security.AccessControlContext;
+import java.security.AccessController;
+import java.security.CodeSource;
+import java.security.Policy;
import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.ProtectionDomain;
import java.text.MessageFormat;
+import sun.rmi.server.LoaderHandler;
import sun.rmi.server.UnicastServerRef;
import sun.rmi.server.UnicastServerRef2;
import sun.rmi.transport.LiveRef;
import sun.rmi.transport.ObjectTable;
import sun.rmi.transport.Target;
+import sun.security.action.GetPropertyAction;
/**
* A "registry" exists on every node that allows RMI connections to
@@ -325,6 +335,19 @@ public class RegistryImpl extends java.rmi.server.RemoteServer
URL[] urls = sun.misc.URLClassPath.pathToURLs(envcp);
ClassLoader cl = new URLClassLoader(urls);
+ String codebaseProperty = null;
+ String prop = java.security.AccessController.doPrivileged(
+ new GetPropertyAction("java.rmi.server.codebase"));
+ if (prop != null && prop.trim().length() > 0) {
+ codebaseProperty = prop;
+ }
+ URL[] codebaseURLs = null;
+ if (codebaseProperty != null) {
+ codebaseURLs = sun.misc.URLClassPath.pathToURLs(codebaseProperty);
+ } else {
+ codebaseURLs = new URL[0];
+ }
+
/*
* Fix bugid 4242317: Classes defined by this class loader should
* be annotated with the value of the "java.rmi.server.codebase"
@@ -334,11 +357,19 @@ public class RegistryImpl extends java.rmi.server.RemoteServer
Thread.currentThread().setContextClassLoader(cl);
- int regPort = Registry.REGISTRY_PORT;
- if (args.length >= 1) {
- regPort = Integer.parseInt(args[0]);
+ final int regPort = (args.length >= 1) ? Integer.parseInt(args[0])
+ : Registry.REGISTRY_PORT;
+ try {
+ registry = AccessController.doPrivileged(
+ new PrivilegedExceptionAction
+bottom
+
+
diff --git a/test/javax/swing/JSlider/6348946/bug6348946.java b/test/javax/swing/JSlider/6348946/bug6348946.java
new file mode 100644
index 0000000000000000000000000000000000000000..7183debcb5e52ddf9c90cf6fe54b51a5413c26d8
--- /dev/null
+++ b/test/javax/swing/JSlider/6348946/bug6348946.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2007, 2011, 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 6348946
+ * @summary Tests that JSlider's thumb moves in the right direction
+ * when it is used as a JTable cell editor.
+ * @author Mikhail Lapshin
+*/
+
+import sun.awt.SunToolkit;
+
+import java.awt.*;
+import java.awt.event.InputEvent;
+import javax.swing.*;
+import javax.swing.event.*;
+import javax.swing.table.*;
+
+public class bug6348946 {
+
+ private static JFrame frame;
+
+ private static JPanel panel;
+
+ private static volatile boolean passed = false;
+
+ public static void main(String[] args) throws Exception {
+ String lf = "javax.swing.plaf.metal.MetalLookAndFeel";
+ UIManager.setLookAndFeel(lf);
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ setupUI();
+ }
+ });
+ toolkit.realSync();
+ clickOnSlider();
+ toolkit.realSync();
+ checkResult();
+ } finally {
+ stopEDT();
+ }
+ }
+
+ private static void setupUI() {
+ frame = new JFrame();
+
+ panel = new JPanel();
+ panel.setLayout(new BorderLayout());
+ panel.add(new ParameterTable(), BorderLayout.CENTER);
+ frame.getContentPane().add(panel);
+
+ frame.pack();
+ frame.setLocationRelativeTo(null);
+ frame.setVisible(true);
+ }
+
+ private static void clickOnSlider() throws Exception {
+ Robot robot = new Robot();
+ robot.setAutoDelay(10);
+
+ Rectangle rect = getPanelRectangle();
+
+ double clickX = rect.getX() + rect.getWidth() / 4;
+ double clickY = rect.getY() + rect.getHeight() / 2;
+ robot.mouseMove((int) clickX, (int) clickY);
+
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ }
+
+ private static void checkResult(){
+ if (passed) {
+ System.out.println("Test passed");
+ } else {
+ throw new RuntimeException("The thumb moved " +
+ "to the right instead of the left!");
+ }
+ }
+
+ private static void stopEDT() {
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ frame.dispose();
+ }
+ });
+ }
+
+ private static class ParameterTable extends JTable {
+ public ParameterTable() {
+ super(new Object[][]{{5}}, new String[]{"Value"});
+ getColumnModel().getColumn(0).setCellRenderer(new Renderer());
+ getColumnModel().getColumn(0).setCellEditor(new Editor());
+ }
+ }
+
+ private static class Renderer implements TableCellRenderer {
+ private JSlider slider = new JSlider(0, 10);
+
+ public Component getTableCellRendererComponent(JTable table,
+ Object value,
+ boolean isSelected,
+ boolean hasFocus,
+ int row, int col) {
+ int val = (Integer) value;
+ slider.setValue(val);
+ return slider;
+ }
+ }
+
+ private static class Editor extends AbstractCellEditor implements TableCellEditor {
+ private JSlider slider = new JSlider(0, 10);
+
+ public Component getTableCellEditorComponent(JTable table, Object value,
+ boolean isSelected,
+ int row, int col) {
+ int val = (Integer) value;
+ slider.setValue(val);
+ return slider;
+ }
+
+ public Editor() {
+ slider.addChangeListener(new ChangeListener() {
+ public void stateChanged(ChangeEvent e) {
+ if (!slider.getValueIsAdjusting()) {
+ passed = slider.getValue() <= 5;
+ }
+ }
+ });
+ }
+
+ public Object getCellEditorValue() {
+ return slider.getValue();
+ }
+ }
+
+ private static Rectangle getPanelRectangle() throws Exception{
+ final Rectangle[] result = new Rectangle[1];
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ result[0] = new Rectangle(panel.getLocationOnScreen(), panel.getSize());
+ }
+ });
+
+ return result[0];
+ }
+}
diff --git a/test/javax/swing/JTextArea/7049024/bug7049024.java b/test/javax/swing/JTextArea/7049024/bug7049024.java
new file mode 100644
index 0000000000000000000000000000000000000000..e6398b2f07c0ea4c3160ffcc8ce15f0db86e17f7
--- /dev/null
+++ b/test/javax/swing/JTextArea/7049024/bug7049024.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2011 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.
+ */
+
+/*
+ * Portions Copyright (c) 2011 IBM Corporation
+ */
+
+/* @test
+ * @bug 7049024
+ * @summary DnD fails with JTextArea and JTextField
+ * @author Sean Chou
+ */
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import javax.swing.text.DefaultCaret;
+import java.awt.*;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.DataFlavor;
+
+public class bug7049024 {
+ public static Clipboard clipboard = null;
+
+ public static JTextField textField = null;
+
+ // This button is used to move focus away from textField.
+ public static JButton button = null;
+
+ public static JFrame frame = null;
+
+ public static DefaultCaret caret = null;
+
+ public static void main(String[] args) throws Exception {
+
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ frame = new JFrame("Test");
+ textField = new JTextField("test selection for textfield");
+ button = new JButton("To compete the focus");
+
+ frame.setLayout(new FlowLayout());
+ frame.getContentPane().add(textField);
+ frame.getContentPane().add(button);
+
+ frame.pack();
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.setVisible(true);
+ }
+ });
+ toolkit.realSync();
+
+ clipboard = textField.getToolkit().getSystemSelection();
+ if (null == clipboard) {
+ return;
+ }
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ textField.requestFocusInWindow();
+ }
+ });
+ toolkit.realSync();
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ caret = (DefaultCaret) textField.getCaret();
+ caret.setDot(2);
+ caret.moveDot(4);
+ }
+ });
+ toolkit.realSync();
+
+ String oldSelection = (String) clipboard.getData(DataFlavor.stringFlavor);
+ System.out.println("oldSelection is " + oldSelection);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ button.requestFocusInWindow();
+ }
+ });
+ toolkit.realSync(); // So JTextField loses the focus.
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ caret.setDot(4);
+ caret.moveDot(6);
+ }
+ });
+ toolkit.realSync();
+
+ String newSelection = (String) clipboard.getData(DataFlavor.stringFlavor);
+ System.out.println("newSelection is " + newSelection);
+
+ boolean passed = newSelection.equals(oldSelection);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ frame.dispose();
+ }
+ });
+
+ if (!passed) {
+ throw new RuntimeException("The test for bug 7049024 failed");
+ }
+ }
+}
diff --git a/test/javax/swing/ToolTipManager/Test6256140.java b/test/javax/swing/ToolTipManager/Test6256140.java
new file mode 100644
index 0000000000000000000000000000000000000000..12d5df8be033b4aa3b401e7cc9c9fe94d3362b91
--- /dev/null
+++ b/test/javax/swing/ToolTipManager/Test6256140.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2007, 2011, 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 6256140
+ * @summary Esc key doesn't restore old value in JFormattedtextField when ToolTip is set
+ * @author Alexander Potochkin
+ * @run main Test6256140
+ */
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.KeyEvent;
+
+public class Test6256140 {
+
+ private static volatile JFormattedTextField ft;
+
+ private final static String initialText = "value";
+ private final static JLabel toolTipLabel = new JLabel("tip");
+
+ public static void main(String[] args) throws Exception {
+
+ Robot robot = new Robot();
+ robot.setAutoDelay(10);
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ public void run() {
+ createAndShowGUI();
+ }
+ });
+ toolkit.realSync();
+
+ Point point = ft.getLocationOnScreen();
+ robot.mouseMove(point.x, point.y);
+ robot.mouseMove(point.x + 3, point.y + 3);
+
+ robot.keyPress(KeyEvent.VK_A);
+ robot.keyRelease(KeyEvent.VK_A);
+ toolkit.realSync();
+
+ if (!isTooltipShowning()) {
+ throw new RuntimeException("Tooltip is not shown");
+ }
+
+ robot.keyPress(KeyEvent.VK_ESCAPE);
+ robot.keyRelease(KeyEvent.VK_ESCAPE);
+ toolkit.realSync();
+
+ if (isTooltipShowning()) {
+ throw new RuntimeException("Tooltip must be hidden now");
+ }
+
+ if (isTextEqual()) {
+ throw new RuntimeException("FormattedTextField must *not* cancel the updated value this time");
+ }
+
+ robot.keyPress(KeyEvent.VK_ESCAPE);
+ robot.keyRelease(KeyEvent.VK_ESCAPE);
+ toolkit.realSync();
+
+ if (!isTextEqual()) {
+ throw new RuntimeException("FormattedTextField must cancel the updated value");
+ }
+ }
+
+ private static boolean isTooltipShowning() throws Exception {
+ final boolean[] result = new boolean[1];
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ result[0] = toolTipLabel.isShowing();
+ }
+ });
+
+ return result[0];
+ }
+
+ private static boolean isTextEqual() throws Exception {
+ final boolean[] result = new boolean[1];
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+ @Override
+ public void run() {
+ result[0] = initialText.equals(ft.getText());
+ }
+ });
+
+ return result[0];
+ }
+
+ private static void createAndShowGUI() {
+ ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE);
+ ToolTipManager.sharedInstance().setInitialDelay(0);
+
+ final JFrame frame = new JFrame();
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.setLayout(new FlowLayout());
+
+ ft = new JFormattedTextField() {
+
+ public JToolTip createToolTip() {
+ JToolTip toolTip = super.createToolTip();
+ toolTip.setLayout(new BorderLayout());
+ toolTip.add(toolTipLabel);
+ return toolTip;
+ }
+ };
+ ft.setToolTipText(" ");
+ ft.setValue(initialText);
+ frame.add(ft);
+
+ frame.pack();
+ frame.setLocationRelativeTo(null);
+ frame.setVisible(true);
+ ft.requestFocus();
+ }
+}
diff --git a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/GenSSLConfigs/main.java b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/GenSSLConfigs/main.java
index 9a18be3240fe82d34e7056ebc2097096c66031b5..432aed4ffe360cf11893f816f526fae850e42ea3 100644
--- a/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/GenSSLConfigs/main.java
+++ b/test/sun/security/ssl/com/sun/net/ssl/internal/ssl/GenSSLConfigs/main.java
@@ -1,10 +1,7 @@
/*
* @test
* @build TestThread Traffic Handler ServerHandler ServerThread ClientThread
- * @run main/othervm/timeout=140 main
- *
- * SunJSSE does not support dynamic system properties, no way to re-use
- * system properties in samevm/agentvm mode.
+ * @run main/othervm/timeout=140 -Djsse.enableCBCProtection=false main
* @summary Make sure that different configurations of SSL sockets work
*/
diff --git a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/CheckStatus.java b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/CheckStatus.java
index c29f55a04b9f80dd22097f5e8c4c9f7e38b757d2..dfdefa9f1f76307b741ad6b1296570596a200a96 100644
--- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/CheckStatus.java
+++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/CheckStatus.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -29,6 +29,8 @@
* This is a simple hack to test a bunch of conditions and check
* their return codes.
*
+ * @run main/othervm -Djsse.enableCBCProtection=false CheckStatus
+ *
* @author Brad Wetmore
*/
diff --git a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/LargeBufs.java b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/LargeBufs.java
index 849e739c8236f026bd2910462238690cec3b6bba..5960ea639926fe8b8665792576940979c66ed668 100644
--- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/LargeBufs.java
+++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/LargeBufs.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2011, 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
@@ -30,6 +30,8 @@
* This is to test larger buffer arrays, and make sure the maximum
* is being passed.
*
+ * @run main/othervm -Djsse.enableCBCProtection=false LargeBufs
+ *
* @author Brad R. Wetmore
*/
diff --git a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/LargePacket.java b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/LargePacket.java
index 9740b67021e37765df28c94083ce1b2699f18cfb..498df71463aad1eca72f7b806f6725051c4981c7 100644
--- a/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/LargePacket.java
+++ b/test/sun/security/ssl/javax/net/ssl/NewAPIs/SSLEngine/LargePacket.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2011, 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
@@ -27,10 +27,7 @@
* @bug 6388456
* @summary Need adjustable TLS max record size for interoperability
* with non-compliant
- * @run main/othervm LargePacket
- *
- * SunJSSE does not support dynamic system properties, no way to re-use
- * system properties in samevm/agentvm mode.
+ * @run main/othervm -Djsse.enableCBCProtection=false LargePacket
*
* @author Xuelei Fan
*/
diff --git a/test/sun/text/resources/Collator/Bug6755060.java b/test/sun/text/resources/Collator/Bug6755060.java
new file mode 100644
index 0000000000000000000000000000000000000000..ee23487d44bc3bdccd82d875500097460d03a568
--- /dev/null
+++ b/test/sun/text/resources/Collator/Bug6755060.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2011, 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 6755060
+ * @summary updating collation tables for thai to make it consistent with CLDR 1.9
+ */
+
+import java.text.*;
+import java.util.*;
+
+public class Bug6755060 {
+
+ /********************************************************
+ *********************************************************/
+ public static void main (String[] args) {
+
+ Locale reservedLocale = Locale.getDefault();
+
+ try{
+
+ int errors=0;
+
+ Locale loc = new Locale ("th", "TH"); // Thai
+
+ Locale.setDefault (loc);
+ Collator col = Collator.getInstance ();
+
+ /*
+ * The original data "data" are the data to be sorted provided by the submitter of the CR.
+ * It's in correct order in accord with thai collation in CLDR 1.9. If we use old Java without this fix,
+ * the output order will be incorrect. Correct order will be turned into incorrect order.
+
+ * If fix is there, "data" after sorting will be unchanged, same as "sortedData". If fix is lost (regression),
+ * "data" after sorting will be changed, not as "sortedData".(not correct anymore)
+
+ * The submitter of the CR also gives a expected "sortedData" in the CR, but it's in accord with collation in CLDR 1.4.
+ * His data to be sorted are actually well sorted in accord with CLDR 1.9.
+ */
+
+ String[] data = {"\u0e01", "\u0e01\u0e2f", "\u0e01\u0e46", "\u0e01\u0e4f", "\u0e01\u0e5a", "\u0e01\u0e5b", "\u0e01\u0e4e", "\u0e01\u0e4c", "\u0e01\u0e48", "\u0e01\u0e01", "\u0e01\u0e4b\u0e01", "\u0e01\u0e4d", "\u0e01\u0e30", "\u0e01\u0e31\u0e01", "\u0e01\u0e32", "\u0e01\u0e33", "\u0e01\u0e34", "\u0e01\u0e35", "\u0e01\u0e36", "\u0e01\u0e37", "\u0e01\u0e38", "\u0e01\u0e39", "\u0e40\u0e01", "\u0e40\u0e01\u0e48", "\u0e40\u0e01\u0e49", "\u0e40\u0e01\u0e4b", "\u0e41\u0e01", "\u0e42\u0e01", "\u0e43\u0e01", "\u0e44\u0e01", "\u0e01\u0e3a", "\u0e24\u0e32", "\u0e24\u0e45", "\u0e40\u0e25", "\u0e44\u0e26"};
+
+ String[] sortedData = {"\u0e01", "\u0e01\u0e2f", "\u0e01\u0e46", "\u0e01\u0e4f", "\u0e01\u0e5a", "\u0e01\u0e5b", "\u0e01\u0e4e", "\u0e01\u0e4c", "\u0e01\u0e48", "\u0e01\u0e01", "\u0e01\u0e4b\u0e01", "\u0e01\u0e4d", "\u0e01\u0e30", "\u0e01\u0e31\u0e01", "\u0e01\u0e32", "\u0e01\u0e33", "\u0e01\u0e34", "\u0e01\u0e35", "\u0e01\u0e36", "\u0e01\u0e37", "\u0e01\u0e38", "\u0e01\u0e39", "\u0e40\u0e01", "\u0e40\u0e01\u0e48", "\u0e40\u0e01\u0e49", "\u0e40\u0e01\u0e4b", "\u0e41\u0e01", "\u0e42\u0e01", "\u0e43\u0e01", "\u0e44\u0e01", "\u0e01\u0e3a", "\u0e24\u0e32", "\u0e24\u0e45", "\u0e40\u0e25", "\u0e44\u0e26"};
+
+ Arrays.sort (data, col);
+
+ System.out.println ("Using " + loc.getDisplayName());
+ for (int i = 0; i < data.length; i++) {
+ System.out.println(data[i] + " : " + sortedData[i]);
+ if (sortedData[i].compareTo(data[i]) != 0) {
+ errors++;
+ }
+ }//end for
+
+ if (errors > 0){
+ StringBuffer expected = new StringBuffer(), actual = new StringBuffer();
+ expected.append(sortedData[0]);
+ actual.append(data[0]);
+
+ for (int i=1; i