changeset 3044:28be97898e83

Merge
author lana
date Thu, 04 Nov 2010 15:38:39 -0700
parents e127cb5c2fbd 3e6726bbf80a
children fdb611a9fdce
files
diffstat 93 files changed, 1482 insertions(+), 367 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Tue Nov 02 15:04:13 2010 +0000
+++ b/.hgtags	Thu Nov 04 15:38:39 2010 -0700
@@ -88,3 +88,6 @@
 fb63a2688db807a73e2a3de7d9bab298f1bff0e8 jdk7-b111
 b53f226b1d91473ac54184afa827be07b87e0319 jdk7-b112
 61d3b9fbb26bdef56cfa41b9af5bc312a22cbeb8 jdk7-b113
+e250cef36ea05e627e7e6f7d75e5e19f529e2ba3 jdk7-b114
+449bad8d67b5808ecf0f927683acc0a5940f8c85 jdk7-b115
+1657ed4e1d86c8aa2028ab5a41f9da1ac4a369f8 jdk7-b116
--- a/make/common/internal/Resources.gmk	Tue Nov 02 15:04:13 2010 +0000
+++ b/make/common/internal/Resources.gmk	Thu Nov 04 15:38:39 2010 -0700
@@ -251,13 +251,13 @@
 # Make sure the build rule creates all the properties
 resources:
 
-ifneq ($(PROPERTIES_FILES),)
+ifneq ($(strip $(PROPERTIES_FILES)),)
   resources: strip_prop_options_clean   strip_all_props
   clobber clean:: 
 	$(RM) $(STRIP_PROP_FILES) $(STRIP_PROP_options)
 endif
 
-ifneq ($(COMPILED_PROPERTIES),)
+ifneq ($(strip $(COMPILED_PROPERTIES)),)
   resources: compile_prop_options_clean compile_all_props
   clobber clean:: 
 	$(RM) $(COMPILE_PROP_JAVA_FILES) $(COMPILE_PROP_options)
--- a/make/common/shared/Defs-javadoc.gmk	Tue Nov 02 15:04:13 2010 +0000
+++ b/make/common/shared/Defs-javadoc.gmk	Thu Nov 04 15:38:39 2010 -0700
@@ -45,7 +45,7 @@
 PLUGIN2_FIRST_COPYRIGHT_YEAR        = 2007
 
 # Oracle name
-COMPANY_NAME = Oracle and/or its affiliates
+FULL_COMPANY_NAME = Oracle and/or its affiliates
 
 # Copyright address
 COMPANY_ADDRESS = 500 Oracle Parkway<br>Redwood Shores, CA 94065 USA.
--- a/make/common/shared/Defs.gmk	Tue Nov 02 15:04:13 2010 +0000
+++ b/make/common/shared/Defs.gmk	Thu Nov 04 15:38:39 2010 -0700
@@ -341,7 +341,33 @@
 include $(_PRIVATE_DEFS_FILE)
 endif
 
+# OUTPUTDIR: Location of all output for the build
+ifdef ALT_OUTPUTDIR
+  OUTPUTDIR:=$(subst \,/,$(ALT_OUTPUTDIR))
+  # Assumes this is absolute (checks later)
+  ABS_OUTPUTDIR:=$(OUTPUTDIR)
+else
+  ifndef _OUTPUTDIR
+    # Default:  Get "build" parent directory, which should always exist
+    ifndef BUILD_PARENT_DIRECTORY
+      BUILD_PARENT_DIRECTORY=$(BUILDDIR)/..
+    endif
+    ifdef OPENJDK
+      _OUTPUTDIRNAME=$(PLATFORM)-$(ARCH)$(OPENJDK_SUFFIX)
+    else
+      _OUTPUTDIRNAME=$(PLATFORM)-$(ARCH)
+    endif
+    _OUTPUTDIR=$(BUILD_PARENT_DIRECTORY)/build/$(_OUTPUTDIRNAME)
+  endif
+  OUTPUTDIR:=$(_OUTPUTDIR)
+endif
+# Check for spaces and null value
+OUTPUTDIR:=$(call AltCheckSpaces,OUTPUTDIR)
+OUTPUTDIR:=$(call AltCheckValue,OUTPUTDIR)
+
 # Get platform specific settings
+# NB: OUTPUTDIR must be defined. Otherwise hotspot import detection will not work correctly
+# On other hand this must be included early as it provides platform specific defines such as FullPath
 include $(JDK_MAKE_SHARED_DIR)/Defs-$(PLATFORM).gmk
 
 # Components
@@ -478,32 +504,6 @@
 CACERTS_FILE:=$(call AltCheckSpaces,CACERTS_FILE)
 CACERTS_FILE:=$(call AltCheckValue,CACERTS_FILE)
 
-# OUTPUTDIR: Location of all output for the build
-ifdef ALT_OUTPUTDIR
-  OUTPUTDIR:=$(subst \,/,$(ALT_OUTPUTDIR))
-  # Assumes this is absolute (checks later)
-  ABS_OUTPUTDIR:=$(OUTPUTDIR)
-else
-  ifndef _OUTPUTDIR
-    # Default:  Get "build" parent directory, which should always exist
-    ifndef BUILD_PARENT_DIRECTORY
-      BUILD_PARENT_DIRECTORY=$(BUILDDIR)/..
-    endif
-    ABS_BUILD_PARENT_DIRECTORY:=$(call FullPath,$(BUILD_PARENT_DIRECTORY))
-    ifdef OPENJDK
-      _OUTPUTDIRNAME=$(PLATFORM)-$(ARCH)$(OPENJDK_SUFFIX)
-    else
-      _OUTPUTDIRNAME=$(PLATFORM)-$(ARCH)
-    endif
-    _OUTPUTDIR=$(BUILD_PARENT_DIRECTORY)/build/$(_OUTPUTDIRNAME)
-    ABS_OUTPUTDIR:=$(ABS_BUILD_PARENT_DIRECTORY)/build/$(_OUTPUTDIRNAME)
-  endif
-  OUTPUTDIR:=$(_OUTPUTDIR)
-endif
-# Check for spaces and null value
-OUTPUTDIR:=$(call AltCheckSpaces,OUTPUTDIR)
-OUTPUTDIR:=$(call AltCheckValue,OUTPUTDIR)
-
 #
 # When signing the JCE framework and provider, we could be using built
 # bits on a read-only filesystem.  If so, this test will fail and crash
@@ -519,7 +519,13 @@
 
 # Define absolute path if needed and check for spaces and null value
 ifndef ABS_OUTPUTDIR
-  ABS_OUTPUTDIR:=$(call FullPath,$(OUTPUTDIR))
+  ifdef _OUTPUTDIRNAME
+    #Could not define this at the same time as _OUTPUTDIRNAME as FullPath is not defined at that point
+    ABS_BUILD_PARENT_DIRECTORY:=$(call FullPath,$(BUILD_PARENT_DIRECTORY))
+    ABS_OUTPUTDIR:=$(ABS_BUILD_PARENT_DIRECTORY)/build/$(_OUTPUTDIRNAME)
+  else
+    ABS_OUTPUTDIR:=$(call FullPath,$(OUTPUTDIR))
+  endif
 endif
 ABS_OUTPUTDIR:=$(call AltCheckSpaces,ABS_OUTPUTDIR)
 ABS_OUTPUTDIR:=$(call AltCheckValue,ABS_OUTPUTDIR)
@@ -572,10 +578,23 @@
     ANT_HOME := $(call DirExists,$(JDK_DEVTOOLS_DIR)/share/ant/latest,,)
   endif
 endif
+
+# There are few problems with ant we need to workaround:
+#  1) ant is using temporary directory java.io.tmpdir
+#     However, this directory is not unique enough and two separate ant processes
+#     can easily end up using the exact same temp directory. This may lead to weird build failures
+#     To workaround this we will define tmp dir explicitly
+#  2) ant attempts to detect JDK location based on java.exe location
+#     This is fragile as developer may have JRE first on the PATH. 
+#     To workaround this we will specify JAVA_HOME explicitly
+
+ANT_TMPDIR = $(ABS_OUTPUTDIR)/tmp
+ANT_WORKAROUNDS = ANT_OPTS=-Djava.io.tmpdir='$(ANT_TMPDIR)' JAVA_HOME='$(BOOTDIR)'
+
 ifeq ($(ANT_HOME),)
-  ANT = ant
+  ANT = $(ANT_WORKAROUNDS) ant
 else
-  ANT = $(ANT_HOME)/bin/ant
+  ANT = $(ANT_WORKAROUNDS) $(ANT_HOME)/bin/ant
 endif
 
 ifdef ALT_COPYRIGHT_YEAR
--- a/make/docs/Makefile	Tue Nov 02 15:04:13 2010 +0000
+++ b/make/docs/Makefile	Thu Nov 04 15:38:39 2010 -0700
@@ -57,7 +57,7 @@
 
 # Common Java trademark line
 JAVA_TRADEMARK_LINE = Java is a trademark or registered trademark of \
-$(COMPANY_NAME) in the US and other countries.
+$(FULL_COMPANY_NAME) in the US and other countries.
 
 #
 # Definitions for imported components
--- a/make/sun/image/generic/Makefile	Tue Nov 02 15:04:13 2010 +0000
+++ b/make/sun/image/generic/Makefile	Thu Nov 04 15:38:39 2010 -0700
@@ -69,5 +69,8 @@
             -I$(PLATFORM_SRC)/native/$(PKGDIR)/medialib 
 
 OTHER_CFLAGS += -D__USE_J2D_NAMES -D__MEDIALIB_OLD_NAMES
-OTHER_LDLIBS = $(LIBM) -ldl
 
+ifneq ($(PLATFORM), windows)
+	OTHER_LDLIBS = $(LIBM) -ldl
+endif
+
--- a/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReaderSpi.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageReaderSpi.java	Thu Nov 04 15:38:39 2010 -0700
@@ -45,7 +45,7 @@
     private boolean registered = false;
 
     public BMPImageReaderSpi() {
-        super("Sun Microsystems, Inc.",
+        super("Oracle Corporation",
               "1.0",
               formatNames,
               entensions,
--- a/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriterSpi.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriterSpi.java	Thu Nov 04 15:38:39 2010 -0700
@@ -50,7 +50,7 @@
     private boolean registered = false;
 
     public BMPImageWriterSpi() {
-        super("Sun Microsystems, Inc.",
+        super("Oracle Corporation",
               "1.0",
               formatNames,
               entensions,
--- a/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReaderSpi.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/com/sun/imageio/plugins/gif/GIFImageReaderSpi.java	Thu Nov 04 15:38:39 2010 -0700
@@ -36,7 +36,7 @@
 
 public class GIFImageReaderSpi extends ImageReaderSpi {
 
-    private static final String vendorName = "Sun Microsystems, Inc.";
+    private static final String vendorName = "Oracle Corporation";
 
     private static final String version = "1.0";
 
--- a/src/share/classes/com/sun/imageio/plugins/gif/GIFImageWriterSpi.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/com/sun/imageio/plugins/gif/GIFImageWriterSpi.java	Thu Nov 04 15:38:39 2010 -0700
@@ -36,7 +36,7 @@
 
 public class GIFImageWriterSpi extends ImageWriterSpi {
 
-    private static final String vendorName = "Sun Microsystems, Inc.";
+    private static final String vendorName = "Oracle Corporation";
 
     private static final String version = "1.0";
 
--- a/src/share/classes/com/sun/imageio/plugins/jpeg/JPEG.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/com/sun/imageio/plugins/jpeg/JPEG.java	Thu Nov 04 15:38:39 2010 -0700
@@ -169,7 +169,7 @@
     public static final int ADOBE_YCCK = 2;
 
     // Spi initialization stuff
-    public static final String vendor = "Sun Microsystems, Inc.";
+    public static final String vendor = "Oracle Corporation";
     public static final String version = "0.5";
     // Names of the formats we can read or write
     public static final String [] names = {"JPEG", "jpeg", "JPG", "jpg"};
--- a/src/share/classes/com/sun/imageio/plugins/png/PNGImageReaderSpi.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/com/sun/imageio/plugins/png/PNGImageReaderSpi.java	Thu Nov 04 15:38:39 2010 -0700
@@ -36,7 +36,7 @@
 
 public class PNGImageReaderSpi extends ImageReaderSpi {
 
-    private static final String vendorName = "Sun Microsystems, Inc.";
+    private static final String vendorName = "Oracle Corporation";
 
     private static final String version = "1.0";
 
--- a/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriterSpi.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/com/sun/imageio/plugins/png/PNGImageWriterSpi.java	Thu Nov 04 15:38:39 2010 -0700
@@ -38,7 +38,7 @@
 
 public class PNGImageWriterSpi extends ImageWriterSpi {
 
-    private static final String vendorName = "Sun Microsystems, Inc.";
+    private static final String vendorName = "Oracle Corporation";
 
     private static final String version = "1.0";
 
--- a/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReaderSpi.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageReaderSpi.java	Thu Nov 04 15:38:39 2010 -0700
@@ -49,7 +49,7 @@
     private boolean registered = false;
 
     public WBMPImageReaderSpi() {
-        super("Sun Microsystems, Inc.",
+        super("Oracle Corporation",
               "1.0",
               formatNames,
               entensions,
--- a/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageWriterSpi.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/com/sun/imageio/plugins/wbmp/WBMPImageWriterSpi.java	Thu Nov 04 15:38:39 2010 -0700
@@ -49,7 +49,7 @@
     private boolean registered = false;
 
     public WBMPImageWriterSpi() {
-        super("Sun Microsystems, Inc.",
+        super("Oracle Corporation",
               "1.0",
               formatNames,
               entensions,
--- a/src/share/classes/com/sun/imageio/spi/FileImageInputStreamSpi.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/com/sun/imageio/spi/FileImageInputStreamSpi.java	Thu Nov 04 15:38:39 2010 -0700
@@ -33,7 +33,7 @@
 
 public class FileImageInputStreamSpi extends ImageInputStreamSpi {
 
-    private static final String vendorName = "Sun Microsystems, Inc.";
+    private static final String vendorName = "Oracle Corporation";
 
     private static final String version = "1.0";
 
--- a/src/share/classes/com/sun/imageio/spi/FileImageOutputStreamSpi.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/com/sun/imageio/spi/FileImageOutputStreamSpi.java	Thu Nov 04 15:38:39 2010 -0700
@@ -33,7 +33,7 @@
 
 public class FileImageOutputStreamSpi extends ImageOutputStreamSpi {
 
-    private static final String vendorName = "Sun Microsystems, Inc.";
+    private static final String vendorName = "Oracle Corporation";
 
     private static final String version = "1.0";
 
--- a/src/share/classes/com/sun/imageio/spi/InputStreamImageInputStreamSpi.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/com/sun/imageio/spi/InputStreamImageInputStreamSpi.java	Thu Nov 04 15:38:39 2010 -0700
@@ -36,7 +36,7 @@
 
 public class InputStreamImageInputStreamSpi extends ImageInputStreamSpi {
 
-    private static final String vendorName = "Sun Microsystems, Inc.";
+    private static final String vendorName = "Oracle Corporation";
 
     private static final String version = "1.0";
 
--- a/src/share/classes/com/sun/imageio/spi/OutputStreamImageOutputStreamSpi.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/com/sun/imageio/spi/OutputStreamImageOutputStreamSpi.java	Thu Nov 04 15:38:39 2010 -0700
@@ -36,7 +36,7 @@
 
 public class OutputStreamImageOutputStreamSpi extends ImageOutputStreamSpi {
 
-    private static final String vendorName = "Sun Microsystems, Inc.";
+    private static final String vendorName = "Oracle Corporation";
 
     private static final String version = "1.0";
 
--- a/src/share/classes/com/sun/imageio/spi/RAFImageInputStreamSpi.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/com/sun/imageio/spi/RAFImageInputStreamSpi.java	Thu Nov 04 15:38:39 2010 -0700
@@ -34,7 +34,7 @@
 
 public class RAFImageInputStreamSpi extends ImageInputStreamSpi {
 
-    private static final String vendorName = "Sun Microsystems, Inc.";
+    private static final String vendorName = "Oracle Corporation";
 
     private static final String version = "1.0";
 
--- a/src/share/classes/com/sun/imageio/spi/RAFImageOutputStreamSpi.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/com/sun/imageio/spi/RAFImageOutputStreamSpi.java	Thu Nov 04 15:38:39 2010 -0700
@@ -34,7 +34,7 @@
 
 public class RAFImageOutputStreamSpi extends ImageOutputStreamSpi {
 
-    private static final String vendorName = "Sun Microsystems, Inc.";
+    private static final String vendorName = "Oracle Corporation";
 
     private static final String version = "1.0";
 
--- a/src/share/classes/com/sun/media/sound/RealTimeSequencer.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/com/sun/media/sound/RealTimeSequencer.java	Thu Nov 04 15:38:39 2010 -0700
@@ -1069,7 +1069,7 @@
     private static class RealTimeSequencerInfo extends MidiDevice.Info {
 
         private static final String name = "Real Time Sequencer";
-        private static final String vendor = "Sun Microsystems";
+        private static final String vendor = "Oracle Corporation";
         private static final String description = "Software sequencer";
         private static final String version = "Version 1.0";
 
--- a/src/share/classes/java/awt/AWTEvent.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/java/awt/AWTEvent.java	Thu Nov 04 15:38:39 2010 -0700
@@ -101,6 +101,12 @@
     transient boolean isPosted;
 
     /**
+     * Indicates whether this AWTEvent was generated by the system as
+     * opposed to by user code.
+     */
+    private transient boolean isSystemGenerated;
+
+    /**
      * The event mask for selecting component events.
      */
     public final static long COMPONENT_EVENT_MASK = 0x01;
@@ -235,6 +241,12 @@
                 public void setPosted(AWTEvent ev) {
                     ev.isPosted = true;
                 }
+                public void setSystemGenerated(AWTEvent ev) {
+                    ev.isSystemGenerated = true;
+                }
+                public boolean isSystemGenerated(AWTEvent ev) {
+                    return ev.isSystemGenerated;
+                }
             });
     }
 
@@ -554,6 +566,7 @@
                 }
             }
         }
+        that.isSystemGenerated = this.isSystemGenerated;
     }
 
     void dispatched() {
--- a/src/share/classes/java/awt/Canvas.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/java/awt/Canvas.java	Thu Nov 04 15:38:39 2010 -0700
@@ -71,12 +71,13 @@
 
     @Override
     void setGraphicsConfiguration(GraphicsConfiguration gc) {
-        CanvasPeer peer = (CanvasPeer)getPeer();
-        if (peer != null) {
-            gc = peer.getAppropriateGraphicsConfiguration(gc);
+        synchronized(getTreeLock()) {
+            CanvasPeer peer = (CanvasPeer)getPeer();
+            if (peer != null) {
+                gc = peer.getAppropriateGraphicsConfiguration(gc);
+            }
+            super.setGraphicsConfiguration(gc);
         }
-
-        super.setGraphicsConfiguration(gc);
     }
 
     /**
--- a/src/share/classes/java/awt/Container.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/java/awt/Container.java	Thu Nov 04 15:38:39 2010 -0700
@@ -4187,7 +4187,7 @@
             return true;
         }
 
-        for (Container cont = getContainer();
+        for (Container cont = this;
                 cont != null && cont.isLightweight();
                 cont = cont.getContainer())
         {
--- a/src/share/classes/java/awt/SequencedEvent.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/java/awt/SequencedEvent.java	Thu Nov 04 15:38:39 2010 -0700
@@ -64,6 +64,9 @@
     public SequencedEvent(AWTEvent nested) {
         super(nested.getSource(), ID);
         this.nested = nested;
+        // All AWTEvents that are wrapped in SequencedEvents are (at
+        // least currently) implicitly generated by the system
+        SunToolkit.setSystemGenerated(nested);
         synchronized (SequencedEvent.class) {
             list.add(this);
         }
--- a/src/share/classes/java/awt/SplashScreen.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/java/awt/SplashScreen.java	Thu Nov 04 15:38:39 2010 -0700
@@ -318,6 +318,12 @@
             checkVisible();
             _close(splashPtr);
             image = null;
+            SplashScreen.markClosed();
+        }
+    }
+
+    static void markClosed() {
+        synchronized (SplashScreen.class) {
             wasClosed = true;
             theInstance = null;
         }
--- a/src/share/classes/java/awt/Window.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/java/awt/Window.java	Thu Nov 04 15:38:39 2010 -0700
@@ -928,7 +928,10 @@
             return;
         }
         if (beforeFirstWindowShown.getAndSet(false)) {
+            // We don't use SplashScreen.getSplashScreen() to avoid instantiating
+            // the object if it hasn't been requested by user code explicitly
             SunToolkit.closeSplashScreen();
+            SplashScreen.markClosed();
         }
     }
 
--- a/src/share/classes/java/awt/event/InputEvent.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/java/awt/event/InputEvent.java	Thu Nov 04 15:38:39 2010 -0700
@@ -29,8 +29,10 @@
 import java.awt.Component;
 import java.awt.GraphicsEnvironment;
 import java.awt.Toolkit;
+import java.util.Arrays;
+
+import sun.awt.AWTAccessor;
 import sun.util.logging.PlatformLogger;
-import java.util.Arrays;
 
 /**
  * The root event class for all component-level input events.
@@ -54,6 +56,7 @@
  * @since 1.1
  */
 public abstract class InputEvent extends ComponentEvent {
+
     private static final PlatformLogger logger = PlatformLogger.getLogger("java.awt.event.InputEvent");
 
     /**
@@ -288,6 +291,12 @@
         if (!GraphicsEnvironment.isHeadless()) {
             initIDs();
         }
+        AWTAccessor.setInputEventAccessor(
+            new AWTAccessor.InputEventAccessor() {
+                public int[] getButtonDownMasks() {
+                    return InputEvent.getButtonDownMasks();
+                }
+            });
     }
 
     /**
--- a/src/share/classes/java/awt/image/SampleModel.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/java/awt/image/SampleModel.java	Thu Nov 04 15:38:39 2010 -0700
@@ -358,6 +358,15 @@
         int cnt = 0;
         Object o = null;
 
+        int x1 = x + w;
+        int y1 = y + h;
+
+        if (x < 0 || x1 < x || x1 > width ||
+            y < 0 || y1 < y || y1 > height)
+        {
+            throw new ArrayIndexOutOfBoundsException("Invalid coordinates.");
+        }
+
         switch(type) {
 
         case DataBuffer.TYPE_BYTE:
@@ -370,8 +379,8 @@
             else
                 bdata = (byte[])obj;
 
-            for (int i=y; i<y+h; i++) {
-                for (int j=x; j<x+w; j++) {
+            for (int i=y; i<y1; i++) {
+                for (int j=x; j<x1; j++) {
                     o = getDataElements(j, i, o, data);
                     btemp = (byte[])o;
                     for (int k=0; k<numDataElems; k++) {
@@ -393,8 +402,8 @@
             else
                 sdata = (short[])obj;
 
-            for (int i=y; i<y+h; i++) {
-                for (int j=x; j<x+w; j++) {
+            for (int i=y; i<y1; i++) {
+                for (int j=x; j<x1; j++) {
                     o = getDataElements(j, i, o, data);
                     stemp = (short[])o;
                     for (int k=0; k<numDataElems; k++) {
@@ -416,8 +425,8 @@
             else
                 idata = (int[])obj;
 
-            for (int i=y; i<y+h; i++) {
-                for (int j=x; j<x+w; j++) {
+            for (int i=y; i<y1; i++) {
+                for (int j=x; j<x1; j++) {
                     o = getDataElements(j, i, o, data);
                     itemp = (int[])o;
                     for (int k=0; k<numDataElems; k++) {
@@ -439,8 +448,8 @@
             else
                 fdata = (float[])obj;
 
-            for (int i=y; i<y+h; i++) {
-                for (int j=x; j<x+w; j++) {
+            for (int i=y; i<y1; i++) {
+                for (int j=x; j<x1; j++) {
                     o = getDataElements(j, i, o, data);
                     ftemp = (float[])o;
                     for (int k=0; k<numDataElems; k++) {
@@ -462,8 +471,8 @@
             else
                 ddata = (double[])obj;
 
-            for (int i=y; i<y+h; i++) {
-                for (int j=x; j<x+w; j++) {
+            for (int i=y; i<y1; i++) {
+                for (int j=x; j<x1; j++) {
                     o = getDataElements(j, i, o, data);
                     dtemp = (double[])o;
                     for (int k=0; k<numDataElems; k++) {
--- a/src/share/classes/java/text/RuleBasedCollator.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/java/text/RuleBasedCollator.java	Thu Nov 04 15:38:39 2010 -0700
@@ -335,9 +335,15 @@
      * collation rules.  Returns information about whether a string is less
      * than, greater than or equal to another string in a language.
      * This can be overriden in a subclass.
+     *
+     * @exception NullPointerException if <code>source</code> or <code>target</code> is null.
      */
     public synchronized int compare(String source, String target)
     {
+        if (source == null || target == null) {
+            throw new NullPointerException();
+        }
+
         // The basic algorithm here is that we use CollationElementIterators
         // to step through both the source and target strings.  We compare each
         // collation element in the source string against the corresponding one
--- a/src/share/classes/java/util/Locale.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/java/util/Locale.java	Thu Nov 04 15:38:39 2010 -0700
@@ -1715,6 +1715,7 @@
         OpenListResourceBundle bundle = LocaleData.getLocaleNames(inLocale);
 
         String languageName = getDisplayLanguage(inLocale);
+        String scriptName = getDisplayScript(inLocale);
         String countryName = getDisplayCountry(inLocale);
         String[] variantNames = getDisplayVariantArray(bundle, inLocale);
 
@@ -1735,25 +1736,40 @@
         String   mainName       = null;
         String[] qualifierNames = null;
 
-        // The main name is the language, or if there is no language, the country.
-        // If there is neither language nor country (an anomalous situation) then
-        // the display name is simply the variant's display name.
+        // The main name is the language, or if there is no language, the script,
+        // then if no script, the country. If there is no language/script/country
+        // (an anomalous situation) then the display name is simply the variant's
+        // display name.
+        if (languageName.length() == 0 && scriptName.length() == 0 && countryName.length() == 0) {
+            if (variantNames.length == 0) {
+                return "";
+            } else {
+                return formatList(variantNames, listPattern, listCompositionPattern);
+            }
+        }
+        ArrayList<String> names = new ArrayList<String>(4);
         if (languageName.length() != 0) {
-            mainName = languageName;
-            if (countryName.length() != 0) {
-                qualifierNames = new String[variantNames.length + 1];
-                System.arraycopy(variantNames, 0, qualifierNames, 1, variantNames.length);
-                qualifierNames[0] = countryName;
+            names.add(languageName);
+        }
+        if (scriptName.length() != 0) {
+            names.add(scriptName);
+        }
+        if (countryName.length() != 0) {
+            names.add(countryName);
+        }
+        if (variantNames.length != 0) {
+            for (String var : variantNames) {
+                names.add(var);
             }
-            else qualifierNames = variantNames;
         }
-        else if (countryName.length() != 0) {
-            mainName = countryName;
-            qualifierNames = variantNames;
-        }
-        else {
-            return formatList(variantNames, listPattern, listCompositionPattern);
-        }
+
+        // The first one in the main name
+        mainName = names.get(0);
+
+        // Others are qualifiers
+        int numNames = names.size();
+        qualifierNames = (numNames > 1) ?
+                names.subList(1, numNames).toArray(new String[numNames - 1]) : new String[0];
 
         // Create an array whose first element is the number of remaining
         // elements.  This serves as a selector into a ChoiceFormat pattern from
@@ -1941,7 +1957,7 @@
      * @serialField variant     String
      *      variant subtags separated by LOWLINE characters. (See <a href="java/util/Locale.html#getVariant()">getVariant()</a>)
      * @serialField hashcode    int
-     *      deprectated, for forward compatibility only
+     *      deprecated, for forward compatibility only
      * @serialField script      String
      *      script subtag in title case (See <a href="java/util/Locale.html#getScript()">getScript()</a>)
      * @serialField extensions  String
@@ -1979,7 +1995,7 @@
     }
 
     /**
-     * Deserialize this <code>Locale</code>.
+     * Deserializes this <code>Locale</code>.
      * @param in the <code>ObjectInputStream</code> to read
      * @throws IOException
      * @throws ClassNotFoundException
--- a/src/share/classes/java/util/TimeZone.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/java/util/TimeZone.java	Thu Nov 04 15:38:39 2010 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 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
@@ -302,60 +302,94 @@
     }
 
     /**
-     * Returns a name of this time zone suitable for presentation to the user
-     * in the default locale.
-     * This method returns the long name, not including daylight savings.
-     * If the display name is not available for the locale,
-     * then this method returns a string in the
-     * <a href="#NormalizedCustomID">normalized custom ID format</a>.
+     * Returns a long standard time name of this {@code TimeZone} suitable for
+     * presentation to the user in the default locale.
+     *
+     * <p>This method is equivalent to:
+     * <pre><blockquote>
+     * getDisplayName(false, {@link #LONG},
+     *                Locale.getDefault({@link Locale.Category#DISPLAY}))
+     * </blockquote></pre>
+     *
      * @return the human-readable name of this time zone in the default locale.
      * @since 1.2
+     * @see #getDisplayName(boolean, int, Locale)
+     * @see Locale#getDefault(Locale.Category)
+     * @see Locale.Category
      */
     public final String getDisplayName() {
-        return getDisplayName(false, LONG, Locale.getDefault(Locale.Category.DISPLAY));
+        return getDisplayName(false, LONG,
+                              Locale.getDefault(Locale.Category.DISPLAY));
     }
 
     /**
-     * Returns a name of this time zone suitable for presentation to the user
-     * in the specified locale.
-     * This method returns the long name, not including daylight savings.
-     * If the display name is not available for the locale,
-     * then this method returns a string in the
-     * <a href="#NormalizedCustomID">normalized custom ID format</a>.
+     * Returns a long standard time name of this {@code TimeZone} suitable for
+     * presentation to the user in the specified {@code locale}.
+     *
+     * <p>This method is equivalent to:
+     * <pre><blockquote>
+     * getDisplayName(false, {@link #LONG}, locale)
+     * </blockquote></pre>
+     *
      * @param locale the locale in which to supply the display name.
      * @return the human-readable name of this time zone in the given locale.
+     * @exception NullPointerException if {@code locale} is {@code null}.
      * @since 1.2
+     * @see #getDisplayName(boolean, int, Locale)
      */
     public final String getDisplayName(Locale locale) {
         return getDisplayName(false, LONG, locale);
     }
 
     /**
-     * Returns a name of this time zone suitable for presentation to the user
-     * in the default locale.
-     * If the display name is not available for the locale, then this
-     * method returns a string in the
-     * <a href="#NormalizedCustomID">normalized custom ID format</a>.
-     * @param daylight if true, return the daylight savings name.
-     * @param style either <code>LONG</code> or <code>SHORT</code>
+     * Returns a name in the specified {@code style} of this {@code TimeZone}
+     * suitable for presentation to the user in the default locale. If the
+     * specified {@code daylight} is {@code true}, a daylight saving time name
+     * is returned. Otherwise, a standard time name is returned.
+     *
+     * <p>This method is equivalent to:
+     * <pre><blockquote>
+     * getDisplayName(daylight, style,
+     *                Locale.getDefault({@link Locale.Category#DISPLAY}))
+     * </blockquote></pre>
+     *
+     * @param daylight if {@code true}, return the daylight saving time name.
+     * @param style either {@link #LONG} or {@link #SHORT}
      * @return the human-readable name of this time zone in the default locale.
+     * @exception IllegalArgumentException if {@code style} is invalid.
      * @since 1.2
+     * @see #getDisplayName(boolean, int, Locale)
+     * @see Locale#getDefault(Locale.Category)
+     * @see Locale.Category
      */
     public final String getDisplayName(boolean daylight, int style) {
-        return getDisplayName(daylight, style, Locale.getDefault(Locale.Category.DISPLAY));
+        return getDisplayName(daylight, style,
+                              Locale.getDefault(Locale.Category.DISPLAY));
     }
 
     /**
-     * Returns a name of this time zone suitable for presentation to the user
-     * in the specified locale.
-     * If the display name is not available for the locale,
-     * then this method returns a string in the
-     * <a href="#NormalizedCustomID">normalized custom ID format</a>.
-     * @param daylight if true, return the daylight savings name.
-     * @param style either <code>LONG</code> or <code>SHORT</code>
+     * Returns a name in the specified {@code style} of this {@code TimeZone}
+     * suitable for presentation to the user in the specified {@code
+     * locale}. If the specified {@code daylight} is {@code true}, a daylight
+     * saving time name is returned. Otherwise, a standard time name is
+     * returned.
+     *
+     * <p>When looking up a time zone name, the {@linkplain
+     * ResourceBundle.Control#getCandidateLocales(String,Locale) default
+     * <code>Locale</code> search path of <code>ResourceBundle</code>} derived
+     * from the specified {@code locale} is used. (No {@linkplain
+     * ResourceBundle.Control#getFallbackLocale(String,Locale) fallback
+     * <code>Locale</code>} search is performed.) If a time zone name in any
+     * {@code Locale} of the search path, including {@link Locale#ROOT}, is
+     * found, the name is returned. Otherwise, a string in the
+     * <a href="#NormalizedCustomID">normalized custom ID format</a> is returned.
+     *
+     * @param daylight if {@code true}, return the daylight saving time name.
+     * @param style either {@link #LONG} or {@link #SHORT}
      * @param locale the locale in which to supply the display name.
      * @return the human-readable name of this time zone in the given locale.
-     * @exception IllegalArgumentException style is invalid.
+     * @exception IllegalArgumentException if {@code style} is invalid.
+     * @exception NullPointerException if {@code locale} is {@code null}.
      * @since 1.2
      */
     public String getDisplayName(boolean daylight, int style, Locale locale) {
--- a/src/share/classes/javax/sound/sampled/AudioSystem.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/javax/sound/sampled/AudioSystem.java	Thu Nov 04 15:38:39 2010 -0700
@@ -63,7 +63,7 @@
  * <p>Properties can be used to specify the default mixer
  * for specific line types.
  * Both system properties and a properties file are considered.
- * In the Sun reference implementation, the properties file is
+ * In the Oracle reference implementation, the properties file is
  * &quot;lib/sound.properties&quot; in the JRE
  * directory. If a property exists both as a system property and in the
  * properties file, the system property takes precedence. If none is
--- a/src/share/classes/javax/swing/JLayer.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/javax/swing/JLayer.java	Thu Nov 04 15:38:39 2010 -0700
@@ -29,6 +29,7 @@
 
 import javax.swing.plaf.LayerUI;
 import javax.swing.border.Border;
+import javax.accessibility.*;
 import java.awt.*;
 import java.awt.event.*;
 import java.beans.PropertyChangeEvent;
@@ -149,7 +150,7 @@
  */
 public final class JLayer<V extends Component>
         extends JComponent
-        implements Scrollable, PropertyChangeListener {
+        implements Scrollable, PropertyChangeListener, Accessible {
     private V view;
     // this field is necessary because JComponent.ui is transient
     // when layerUI is serializable
@@ -666,6 +667,22 @@
     }
 
     /**
+     * Gets the AccessibleContext associated with this {@code JLayer}.
+     *
+     * @return the AccessibleContext associated with this {@code JLayer}.
+     */
+    public AccessibleContext getAccessibleContext() {
+        if (accessibleContext == null) {
+            accessibleContext = new AccessibleJComponent() {
+                public AccessibleRole getAccessibleRole() {
+                    return AccessibleRole.PANEL;
+                }
+            };
+        }
+        return accessibleContext;
+    }
+
+    /**
      * static AWTEventListener to be shared with all AbstractLayerUIs
      */
     private static class LayerEventController implements AWTEventListener {
--- a/src/share/classes/javax/swing/JTable.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/javax/swing/JTable.java	Thu Nov 04 15:38:39 2010 -0700
@@ -2491,7 +2491,7 @@
      * The default value of this property is defined by the look
      * and feel implementation.
      * <p>
-     * This is a <a href="http://java.sun.com/docs/books/tutorial/javabeans/whatis/beanDefinition.html">JavaBeans</a> bound property.
+     * This is a <a href="http://java.sun.com/docs/books/tutorial/javabeans/properties/bound.html">JavaBeans</a> bound property.
      *
      * @param selectionForeground  the <code>Color</code> to use in the foreground
      *                             for selected list items
@@ -2529,7 +2529,7 @@
      * The default value of this property is defined by the look
      * and feel implementation.
      * <p>
-     * This is a <a href="http://java.sun.com/docs/books/tutorial/javabeans/whatis/beanDefinition.html">JavaBeans</a> bound property.
+     * This is a <a href="http://java.sun.com/docs/books/tutorial/javabeans/properties/bound.html">JavaBeans</a> bound property.
      *
      * @param selectionBackground  the <code>Color</code> to use for the background
      *                             of selected cells
--- a/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/javax/swing/plaf/basic/BasicFileChooserUI.java	Thu Nov 04 15:38:39 2010 -0700
@@ -141,6 +141,22 @@
     private JPanel accessoryPanel = null;
     private Handler handler;
 
+    /**
+     * Creates a {@code BasicFileChooserUI} implementation
+     * for the specified component. By default
+     * the {@code BasicLookAndFeel} class uses
+     * {@code createUI} methods of all basic UIs classes
+     * to instantiate UIs.
+     *
+     * @param c the {@code JFileChooser} which needs a UI
+     * @return the {@code BasicFileChooserUI} object
+     *
+     * @see UIDefaults#getUI(JComponent)
+     * @since 1.7
+     */
+    public static ComponentUI createUI(JComponent c) {
+        return new BasicFileChooserUI((JFileChooser) c);
+    }
 
     public BasicFileChooserUI(JFileChooser b) {
     }
--- a/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/javax/swing/plaf/basic/BasicLookAndFeel.java	Thu Nov 04 15:38:39 2010 -0700
@@ -269,6 +269,7 @@
             "InternalFrameUI", basicPackageName + "BasicInternalFrameUI",
               "DesktopPaneUI", basicPackageName + "BasicDesktopPaneUI",
               "DesktopIconUI", basicPackageName + "BasicDesktopIconUI",
+              "FileChooserUI", basicPackageName + "BasicFileChooserUI",
                "OptionPaneUI", basicPackageName + "BasicOptionPaneUI",
                     "PanelUI", basicPackageName + "BasicPanelUI",
                  "ViewportUI", basicPackageName + "BasicViewportUI",
--- a/src/share/classes/sun/awt/AWTAccessor.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/sun/awt/AWTAccessor.java	Thu Nov 04 15:38:39 2010 -0700
@@ -26,6 +26,7 @@
 package sun.awt;
 
 import java.awt.*;
+import java.awt.event.InputEvent;
 import java.awt.geom.Point2D;
 import java.awt.image.BufferedImage;
 
@@ -301,6 +302,24 @@
          * Marks the event as posted.
          */
         void setPosted(AWTEvent ev);
+
+        /**
+         * Sets the flag on this AWTEvent indicating that it was
+         * generated by the system.
+         */
+        void setSystemGenerated(AWTEvent ev);
+
+        /**
+         * Indicates whether this AWTEvent was generated by the system.
+         */
+        boolean isSystemGenerated(AWTEvent ev);
+    }
+
+    public interface InputEventAccessor {
+        /*
+         * Accessor for InputEvent.getButtonDownMasks()
+         */
+        int[] getButtonDownMasks();
     }
 
     /*
@@ -436,6 +455,11 @@
     private static AWTEventAccessor awtEventAccessor;
 
     /*
+     * The java.awt.event.InputEvent class accessor object.
+     */
+    private static InputEventAccessor inputEventAccessor;
+
+    /*
      * The java.awt.Frame class accessor object.
      */
     private static FrameAccessor frameAccessor;
@@ -518,6 +542,23 @@
     }
 
     /*
+     * Set an accessor object for the java.awt.event.InputEvent class.
+     */
+    public static void setInputEventAccessor(InputEventAccessor iea) {
+        inputEventAccessor = iea;
+    }
+
+    /*
+     * Retrieve the accessor object for the java.awt.event.InputEvent class.
+     */
+    public static InputEventAccessor getInputEventAccessor() {
+        if (inputEventAccessor == null) {
+            unsafe.ensureClassInitialized(InputEvent.class);
+        }
+        return inputEventAccessor;
+    }
+
+    /*
      * Set an accessor object for the java.awt.Frame class.
      */
     public static void setFrameAccessor(FrameAccessor fa) {
--- a/src/share/classes/sun/awt/SunToolkit.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/sun/awt/SunToolkit.java	Thu Nov 04 15:38:39 2010 -0700
@@ -313,6 +313,11 @@
      */
     public static AppContext createNewAppContext() {
         ThreadGroup threadGroup = Thread.currentThread().getThreadGroup();
+        // Create appContext before initialization of EventQueue, so all
+        // the calls to AppContext.getAppContext() from EventQueue ctor
+        // return correct values
+        AppContext appContext = new AppContext(threadGroup);
+
         EventQueue eventQueue;
         String eqName = System.getProperty("AWT.EventQueueClass",
                                            "java.awt.EventQueue");
@@ -322,7 +327,6 @@
             System.err.println("Failed loading " + eqName + ": " + e);
             eventQueue = new EventQueue();
         }
-        AppContext appContext = new AppContext(threadGroup);
         appContext.put(AppContext.EVENT_QUEUE_KEY, eventQueue);
 
         PostEventQueue postEventQueue = new PostEventQueue(eventQueue);
@@ -587,6 +591,12 @@
         if (event == null) {
             throw new NullPointerException();
         }
+        // All events posted via this method are system-generated.
+        // Placing the following call here reduces considerably the
+        // number of places throughout the toolkit that would
+        // otherwise have to be modified to precisely identify
+        // system-generated events.
+        setSystemGenerated(event);
         AppContext eventContext = targetToAppContext(event.getSource());
         if (eventContext != null && !eventContext.equals(appContext)) {
             log.fine("Event posted on wrong app context : " + event);
@@ -2089,6 +2099,25 @@
         }
         return isInstanceOf(cls.getSuperclass(), type);
     }
+
+    ///////////////////////////////////////////////////////////////////////////
+    //
+    // The following methods help set and identify whether a particular
+    // AWTEvent object was produced by the system or by user code. As of this
+    // writing the only consumer is the Java Plug-In, although this information
+    // could be useful to more clients and probably should be formalized in
+    // the public API.
+    //
+    ///////////////////////////////////////////////////////////////////////////
+
+    public static void setSystemGenerated(AWTEvent e) {
+        AWTAccessor.getAWTEventAccessor().setSystemGenerated(e);
+    }
+
+    public static boolean isSystemGenerated(AWTEvent e) {
+        return AWTAccessor.getAWTEventAccessor().isSystemGenerated(e);
+    }
+
 } // class SunToolkit
 
 
--- a/src/share/classes/sun/util/LocaleServiceProviderPool.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/classes/sun/util/LocaleServiceProviderPool.java	Thu Nov 04 15:38:39 2010 -0700
@@ -84,7 +84,7 @@
      * static.  This could be non-static later, so that they could have
      * different sets for each locale sensitive services.
      */
-    private static List<Locale> availableJRELocales = null;
+    private static volatile List<Locale> availableJRELocales = null;
 
     /**
      * Provider locales for this locale sensitive service.
@@ -252,12 +252,16 @@
      *
      * @return list of the available JRE locales
      */
-    private synchronized List<Locale> getJRELocales() {
+    private List<Locale> getJRELocales() {
         if (availableJRELocales == null) {
-            Locale[] allLocales = LocaleData.getAvailableLocales();
-            availableJRELocales = new ArrayList<Locale>(allLocales.length);
-            for (Locale locale : allLocales) {
-                availableJRELocales.add(getLookupLocale(locale));
+            synchronized (LocaleServiceProviderPool.class) {
+                if (availableJRELocales == null) {
+                    Locale[] allLocales = LocaleData.getAvailableLocales();
+                    availableJRELocales = new ArrayList<Locale>(allLocales.length);
+                    for (Locale locale : allLocales) {
+                        availableJRELocales.add(getLookupLocale(locale));
+                    }
+                }
             }
         }
         return availableJRELocales;
--- a/src/share/native/sun/awt/libpng/pngrtran.c	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/native/sun/awt/libpng/pngrtran.c	Thu Nov 04 15:38:39 2010 -0700
@@ -3993,7 +3993,7 @@
 
 #ifdef PNG_FLOATING_POINT_SUPPORTED
 #if defined(PNG_READ_GAMMA_SUPPORTED)
-const static int png_gamma_shift[] =
+static PNG_CONST int png_gamma_shift[] =
    {0x10, 0x21, 0x42, 0x84, 0x110, 0x248, 0x550, 0xff0, 0x00};
 
 /* We build the 8- or 16-bit gamma tables here.  Note that for 16-bit
--- a/src/share/native/sun/awt/libpng/pngrutil.c	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/native/sun/awt/libpng/pngrutil.c	Thu Nov 04 15:38:39 2010 -0700
@@ -209,7 +209,7 @@
                               png_charp chunkdata, png_size_t chunklength,
                               png_size_t prefix_size, png_size_t *newlength)
 {
-   const static char msg[] = "Error decoding compressed text";
+   static PNG_CONST char msg[] = "Error decoding compressed text";
    png_charp text;
    png_size_t text_size;
 
--- a/src/share/native/sun/awt/medialib/mlib_ImageLookUp_64.c	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/native/sun/awt/medialib/mlib_ImageLookUp_64.c	Thu Nov 04 15:38:39 2010 -0700
@@ -558,10 +558,11 @@
                               const mlib_d64 **table)
 {
   const mlib_d64 *table_base[4];
+  mlib_u32 shift = TABLE_SHIFT_S32;
   mlib_s32 c;
 
   for (c = 0; c < csize; c++) {
-    table_base[c] = &table[c][TABLE_SHIFT_S32];
+    table_base[c] = &table[c][shift];
   }
 
   MLIB_C_IMAGELOOKUP(mlib_d64, mlib_s32, table_base);
@@ -1039,10 +1040,11 @@
                                 const mlib_d64 **table)
 {
   const mlib_d64 *table_base[4];
+  mlib_u32 shift = TABLE_SHIFT_S32;
   mlib_s32 c;
 
   for (c = 0; c < csize; c++) {
-    table_base[c] = &table[c][TABLE_SHIFT_S32];
+    table_base[c] = &table[c][shift];
   }
 
   MLIB_C_IMAGELOOKUPSI(mlib_d64, mlib_s32, table_base);
--- a/src/share/native/sun/awt/splashscreen/splashscreen_gif.c	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/share/native/sun/awt/splashscreen/splashscreen_gif.c	Thu Nov 04 15:38:39 2010 -0700
@@ -51,7 +51,7 @@
 #define NSEXT_LOOP      0x01    // Loop Count field code
 
 // convert libungif samples to our ones
-#define MAKE_QUAD_GIF(c,a) MAKE_QUAD((c).Red, (c).Green, (c).Blue, (a))
+#define MAKE_QUAD_GIF(c,a) MAKE_QUAD((c).Red, (c).Green, (c).Blue, (unsigned)(a))
 
 /* stdio FILE* and memory input functions for libungif */
 int
@@ -165,7 +165,7 @@
                 {
                     int flag = pExtension[0];
 
-                    frameDelay = (pExtension[2] << 8) | pExtension[1];
+                    frameDelay = (((int)pExtension[2]) << 8) | pExtension[1];
                     if (frameDelay < 10)
                         frameDelay = 10;
                     if (flag & GIF_TRANSPARENT) {
@@ -191,7 +191,7 @@
                         iSubCode = pExtension[0] & 0x07;
                         if (iSubCode == NSEXT_LOOP) {
                             splash->loopCount =
-                                (pExtension[1] | (pExtension[2] << 8)) - 1;
+                                (pExtension[1] | (((int)pExtension[2]) << 8)) - 1;
                         }
                     }
                     break;
@@ -277,7 +277,7 @@
                 ImageRect dstRect;
                 rgbquad_t fillColor = 0;                        // 0 is transparent
 
-                if (transparentColor > 0) {
+                if (transparentColor < 0) {
                     fillColor= MAKE_QUAD_GIF(
                         colorMap->Colors[gif->SBackGroundColor], 0xff);
                 }
--- a/src/solaris/classes/sun/awt/X11/InfoWindow.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/solaris/classes/sun/awt/X11/InfoWindow.java	Thu Nov 04 15:38:39 2010 -0700
@@ -432,7 +432,7 @@
                     ActionEvent aev = new ActionEvent(target, ActionEvent.ACTION_PERFORMED,
                                                       liveArguments.getActionCommand(),
                                                       e.getWhen(), e.getModifiers());
-                    Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(aev);
+                    XToolkit.postEvent(XToolkit.targetToAppContext(aev.getSource()), aev);
                 }
             }
         }
--- a/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java	Thu Nov 04 15:38:39 2010 -0700
@@ -87,11 +87,15 @@
     }
 
     void postInit(XCreateWindowParams params) {
+        // The size hints must be set BEFORE mapping the window (see 6895647)
+        updateSizeHints(dimensions);
+
+        // The super method maps the window if it's visible on the shared level
         super.postInit(params);
+
         // The lines that follow need to be in a postInit, so they
         // happen after the X window is created.
         initResizability();
-        updateSizeHints(dimensions);
         XWM.requestWMExtents(getWindow());
 
         content = XContentWindow.createContent(this);
--- a/src/solaris/classes/sun/awt/X11/XRobotPeer.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/solaris/classes/sun/awt/X11/XRobotPeer.java	Thu Nov 04 15:38:39 2010 -0700
@@ -25,11 +25,15 @@
 package sun.awt.X11;
 
 import java.awt.*;
+import java.awt.event.InputEvent;
 import java.awt.peer.*;
+
+import sun.awt.AWTAccessor;
+import sun.awt.SunToolkit;
 import sun.awt.X11GraphicsConfig;
-import sun.awt.SunToolkit;
 
 class XRobotPeer implements RobotPeer {
+
     private X11GraphicsConfig   xgc = null;
     /*
      * native implementation uses some static shared data (pipes, processes)
@@ -40,7 +44,7 @@
     XRobotPeer(GraphicsConfiguration gc) {
         this.xgc = (X11GraphicsConfig)gc;
         SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit();
-        setup(tk.getNumberOfButtons());
+        setup(tk.getNumberOfButtons(), AWTAccessor.getInputEventAccessor().getButtonDownMasks());
     }
 
     public void dispose() {
@@ -83,7 +87,7 @@
         return pixelArray;
     }
 
-    private static native synchronized void setup(int numberOfButtons);
+    private static native synchronized void setup(int numberOfButtons, int[] buttonDownMasks);
 
     private static native synchronized void mouseMoveImpl(X11GraphicsConfig xgc, int x, int y);
     private static native synchronized void mousePressImpl(int buttons);
--- a/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/solaris/classes/sun/awt/X11/XTextAreaPeer.java	Thu Nov 04 15:38:39 2010 -0700
@@ -61,6 +61,7 @@
 import java.awt.im.InputMethodRequests;
 import sun.awt.CausedFocusEvent;
 import sun.awt.AWTAccessor;
+import sun.awt.SunToolkit;
 
 
 class XTextAreaPeer extends XComponentPeer implements TextAreaPeer {
@@ -1318,13 +1319,18 @@
             Component source, Point point, MouseEvent template )
         {
             MouseEvent e = template;
-            return new MouseEvent(
+            MouseEvent nme = new MouseEvent(
                 source,
                 e.getID(), e.getWhen(),
                 e.getModifiersEx() | e.getModifiers(),
                 point.x, point.y,
                 e.getXOnScreen(), e.getYOnScreen(),
                 e.getClickCount(), e.isPopupTrigger(), e.getButton() );
+            // Because these MouseEvents are dispatched directly to
+            // their target, we need to mark them as being
+            // system-generated here
+            SunToolkit.setSystemGenerated(nme);
+            return nme;
         }
 
         private void setCursor() {
--- a/src/solaris/classes/sun/awt/X11/XToolkit.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/solaris/classes/sun/awt/X11/XToolkit.java	Thu Nov 04 15:38:39 2010 -0700
@@ -377,22 +377,22 @@
             init();
             XWM.init();
             SunToolkit.setDataTransfererClassName(DATA_TRANSFERER_CLASS_NAME);
-            toolkitThread = new Thread(this, "AWT-XAWT");
-            toolkitThread.setPriority(Thread.NORM_PRIORITY + 1);
-            toolkitThread.setDaemon(true);
-            ThreadGroup mainTG = (ThreadGroup)AccessController.doPrivileged(
-                                                                            new PrivilegedAction() {
-                                                                                    public Object run() {
-                                                                                        ThreadGroup currentTG =
-                                                                                            Thread.currentThread().getThreadGroup();
-                                                                                        ThreadGroup parentTG = currentTG.getParent();
-                                                                                        while (parentTG != null) {
-                                                                                            currentTG = parentTG;
-                                                                                            parentTG = currentTG.getParent();
-                                                                                        }
-                                                                                        return currentTG;
-                                                                                    }
-                                                                                });
+
+            PrivilegedAction<Thread> action = new PrivilegedAction() {
+                public Thread run() {
+                    ThreadGroup currentTG = Thread.currentThread().getThreadGroup();
+                    ThreadGroup parentTG = currentTG.getParent();
+                    while (parentTG != null) {
+                        currentTG = parentTG;
+                        parentTG = currentTG.getParent();
+                    }
+                    Thread thread = new Thread(currentTG, XToolkit.this, "AWT-XAWT");
+                    thread.setPriority(Thread.NORM_PRIORITY + 1);
+                    thread.setDaemon(true);
+                    return thread;
+                }
+            };
+            toolkitThread = AccessController.doPrivileged(action);
             toolkitThread.start();
         }
     }
--- a/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java	Thu Nov 04 15:38:39 2010 -0700
@@ -454,7 +454,7 @@
                 ActionEvent aev = new ActionEvent(xtiPeer.target, ActionEvent.ACTION_PERFORMED,
                                                   xtiPeer.target.getActionCommand(), e.getWhen(),
                                                   e.getModifiers());
-                Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(aev);
+                XToolkit.postEvent(XToolkit.targetToAppContext(aev.getSource()), aev);
             }
             if (xtiPeer.balloon.isVisible()) {
                 xtiPeer.balloon.hide();
--- a/src/solaris/classes/sun/awt/X11/XWindow.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/solaris/classes/sun/awt/X11/XWindow.java	Thu Nov 04 15:38:39 2010 -0700
@@ -401,6 +401,8 @@
         if (isPostedField == null) {
             isPostedField = SunToolkit.getField(AWTEvent.class, "isPosted");
         }
+        // The uses of this method imply that the incoming event is system-generated
+        SunToolkit.setSystemGenerated(e);
         PeerEvent pe = new PeerEvent(Toolkit.getDefaultToolkit(), new Runnable() {
                 public void run() {
                     try {
@@ -779,7 +781,7 @@
                                                           xbe.get_x_root(),
                                                           xbe.get_y_root(),
                                                           1,false,MouseWheelEvent.WHEEL_UNIT_SCROLL,
-                                                          3,button==4 ?  -1*clickCount : 1*clickCount);
+                                                          3,button==4 ?  -1 : 1);
                 postEventToEventQueue(mwe);
             }
         }
--- a/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/solaris/classes/sun/awt/X11/XWindowPeer.java	Thu Nov 04 15:38:39 2010 -0700
@@ -604,7 +604,9 @@
     public void handleWindowFocusIn_Dispatch() {
         if (EventQueue.isDispatchThread()) {
             XKeyboardFocusManagerPeer.setCurrentNativeFocusedWindow((Window) target);
-            target.dispatchEvent(new WindowEvent((Window)target, WindowEvent.WINDOW_GAINED_FOCUS));
+            WindowEvent we = new WindowEvent((Window)target, WindowEvent.WINDOW_GAINED_FOCUS);
+            SunToolkit.setSystemGenerated(we);
+            target.dispatchEvent(we);
         }
     }
 
--- a/src/solaris/classes/sun/awt/X11InputMethod.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/solaris/classes/sun/awt/X11InputMethod.java	Thu Nov 04 15:38:39 2010 -0700
@@ -96,6 +96,7 @@
     private Component awtFocussedComponent = null;
     private Component lastXICFocussedComponent = null;
     private boolean   isLastXICActive = false;
+    private boolean   isLastTemporary = false;
     private boolean   isActive = false;
     private boolean   isActiveClient = false;
     private static Map[] highlightStyles;
@@ -349,7 +350,7 @@
            current focussed component, change the XIC focus to the newly
            focussed component.
         */
-        if (lastXICFocussedComponentPeer != awtFocussedComponentPeer ||
+        if (isLastTemporary || lastXICFocussedComponentPeer != awtFocussedComponentPeer ||
             isLastXICActive != haveActiveClient()) {
             if (lastXICFocussedComponentPeer != null) {
                 setXICFocus(lastXICFocussedComponentPeer, false, isLastXICActive);
@@ -401,6 +402,7 @@
         */
         lastXICFocussedComponent = awtFocussedComponent;
         isLastXICActive = isAc;
+        isLastTemporary = isTemporary;
         isActive = false;
     }
 
--- a/src/solaris/native/sun/awt/awt.h	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/solaris/native/sun/awt/awt.h	Thu Nov 04 15:38:39 2010 -0700
@@ -159,20 +159,8 @@
 #endif /* DEBUG_AWT_LOCK && !XAWT */
 
 #ifndef HEADLESS
-extern Display         *awt_display;            /* awt_GraphicsEnv.c */
-extern XtAppContext     awt_appContext;         /* awt_MToolkit.c */
-extern Widget           awt_root_shell;
-extern Pixel            awt_defaultBg;
-extern Pixel            awt_defaultFg;
-extern int              awt_multiclick_time;    /* awt_MToolkit.c */
-extern int              awt_multiclick_smudge;  /* canvas.c */
-extern unsigned int     awt_MetaMask;           /* awt_MToolkit.c */
-extern unsigned int     awt_AltMask;
-extern unsigned int     awt_NumLockMask;
-extern unsigned int     awt_ModeSwitchMask;
-extern Cursor           awt_scrollCursor;       /* awt_MToolkit.c */
-extern Boolean          awt_ModLockIsShiftLock;
-
+extern Display         *awt_display; /* awt_GraphicsEnv.c */
+extern Boolean          awt_ModLockIsShiftLock; /* XToolkit.c */
 #endif /* !HEADLESS */
 
 #endif /* ! _AWT_ */
--- a/src/solaris/native/sun/awt/awt_DrawingSurface.c	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/solaris/native/sun/awt/awt_DrawingSurface.c	Thu Nov 04 15:38:39 2010 -0700
@@ -264,7 +264,7 @@
 #ifndef XAWT
     px->drawable = XtWindow(cdata->widget);
 #else
-    px->drawable = JNU_GetLongFieldAsPtr(env, peer, windowID);
+    px->drawable = (*env)->GetLongField(env, peer, windowID);
 #endif
     px->display = awt_display;
 
--- a/src/solaris/native/sun/awt/awt_InputMethod.c	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/solaris/native/sun/awt/awt_InputMethod.c	Thu Nov 04 15:38:39 2010 -0700
@@ -46,8 +46,6 @@
 #ifdef XAWT
 #include <sun_awt_X11_XComponentPeer.h>
 #include <sun_awt_X11_XInputMethod.h>
-
-#define XtWindow(w)     (w)
 #else /* !XAWT */
 #include <sun_awt_motif_MComponentPeer.h>
 #include <sun_awt_motif_MInputMethod.h>
@@ -670,7 +668,8 @@
     int  mccr = 0;
     char *dsr;
     Pixel bg, fg, light, dim;
-    int x, y, w, h, bw, depth, off_x, off_y, xx, yy;
+    int x, y, off_x, off_y, xx, yy;
+    unsigned int w, h, bw, depth;
     XGCValues values;
     unsigned long valuemask = 0;  /*ignore XGCvalue and use defaults*/
     int screen = 0;
@@ -709,7 +708,7 @@
     light = adata->AwtColorMatch(195, 195, 195, adata);
     dim   = adata->AwtColorMatch(128, 128, 128, adata);
 
-    XGetWindowAttributes(dpy, XtWindow(parent), &xwa);
+    XGetWindowAttributes(dpy, parent, &xwa);
     bw = 2; /*xwa.border_width does not have the correct value*/
 
     /*compare the size difference between parent container
@@ -717,7 +716,7 @@
       and title bar height (?)*/
 
     XQueryTree( dpy,
-                XtWindow(parent),
+                parent,
                 &rootWindow,
                 &containerWindow,
                 &ignoreWindowPtr,
@@ -731,7 +730,7 @@
     XGetWindowAttributes(dpy, rootWindow, &xxwa);
 
     XTranslateCoordinates(dpy,
-                          XtWindow(parent), xwa.root,
+                          parent, xwa.root,
                           xwa.x, xwa.y,
                           &x, &y,
                           &child);
@@ -833,9 +832,9 @@
     if (statusWindow->parent != parent){
         statusWindow->parent = parent;
     }
-    XGetWindowAttributes(dpy, XtWindow(parent), &xwa);
+    XGetWindowAttributes(dpy, parent, &xwa);
     XTranslateCoordinates(dpy,
-                          XtWindow(parent), xwa.root,
+                          parent, xwa.root,
                           xwa.x, xwa.y,
                           &x, &y,
                           &child);
@@ -966,9 +965,9 @@
         XWindowAttributes xwa;
         int x, y;
         Window child;
-        XGetWindowAttributes(dpy, XtWindow(shell), &xwa);
+        XGetWindowAttributes(dpy, shell, &xwa);
         XTranslateCoordinates(dpy,
-                              XtWindow(shell), xwa.root,
+                              shell, xwa.root,
                               xwa.x, xwa.y,
                               &x, &y,
                               &child);
@@ -1033,7 +1032,7 @@
         return False;
     }
 #ifdef XAWT
-    if (w == NULL) {
+    if (!w) {
         return False;
     }
 #else /* !XAWT */
@@ -1148,8 +1147,8 @@
                 goto err;
             pX11IMData->statusWindow = createStatusWindow(w);
             pX11IMData->ic_active = XCreateIC(X11im,
-                                              XNClientWindow, XtWindow(w),
-                                              XNFocusWindow, XtWindow(w),
+                                              XNClientWindow, w,
+                                              XNFocusWindow, w,
                                               XNInputStyle, active_styles,
                                               XNPreeditAttributes, preedit,
                                               XNStatusAttributes, status,
@@ -1166,8 +1165,8 @@
                 goto err;
             pX11IMData->statusWidget = awt_util_getXICStatusAreaWindow(w);
             pX11IMData->ic_active = XCreateIC(X11im,
-                                              XNClientWindow, XtWindow(pX11IMData->statusWidget),
-                                              XNFocusWindow, XtWindow(w),
+                                              XNClientWindow, pX11IMData->statusWidget,
+                                              XNFocusWindow, w,
                                               XNInputStyle, active_styles,
                                               XNPreeditAttributes, preedit,
                                               XNStatusAttributes, status,
@@ -1176,8 +1175,8 @@
         } else {
 #endif /* XAWT */
             pX11IMData->ic_active = XCreateIC(X11im,
-                                              XNClientWindow, XtWindow(w),
-                                              XNFocusWindow, XtWindow(w),
+                                              XNClientWindow, w,
+                                              XNFocusWindow, w,
                                               XNInputStyle, active_styles,
                                               XNPreeditAttributes, preedit,
                                               NULL);
@@ -1187,15 +1186,15 @@
         XFree((void *)preedit);
 #endif /* __linux__ */
         pX11IMData->ic_passive = XCreateIC(X11im,
-                                           XNClientWindow, XtWindow(w),
-                                           XNFocusWindow, XtWindow(w),
+                                           XNClientWindow, w,
+                                           XNFocusWindow, w,
                                            XNInputStyle, passive_styles,
                                            NULL);
 
     } else {
         pX11IMData->ic_active = XCreateIC(X11im,
-                                          XNClientWindow, XtWindow(w),
-                                          XNFocusWindow, XtWindow(w),
+                                          XNClientWindow, w,
+                                          XNFocusWindow, w,
                                           XNInputStyle, active_styles,
                                           NULL);
         pX11IMData->ic_passive = pX11IMData->ic_active;
@@ -1213,7 +1212,7 @@
     {
         XIMCallback cb;
         cb.client_data = (XPointer) pX11IMData->x11inputmethod;
-        cb.callback = CommitStringCallback;
+        cb.callback = (XIMProc) CommitStringCallback;
         XSetICValues (pX11IMData->ic_active, XNCommitStringCallback, &cb, NULL);
         if (pX11IMData->ic_active != pX11IMData->ic_passive) {
             XSetICValues (pX11IMData->ic_passive, XNCommitStringCallback, &cb, NULL);
@@ -1510,7 +1509,7 @@
     AWT_LOCK();
 
 #ifdef XAWT
-    dpy = (Display *)display;
+    dpy = (Display *)jlong_to_ptr(display);
 #else
     dpy = awt_display;
 #endif
@@ -1520,7 +1519,7 @@
 */
 #ifdef __linux__
     registered = XRegisterIMInstantiateCallback(dpy, NULL, NULL,
-                     NULL, (XIMProc)OpenXIMCallback, NULL);
+                     NULL, (XIDProc)OpenXIMCallback, NULL);
     if (!registered) {
         /* directly call openXIM callback */
 #endif
@@ -1555,7 +1554,7 @@
     AWT_LOCK();
 
 #ifdef XAWT
-    if (window == NULL) {
+    if (!window) {
 #else /* !XAWT */
     if (JNU_IsNull(env, comp)) {
 #endif /* XAWT */
@@ -1664,7 +1663,7 @@
              * On Solaris2.6, setXICWindowFocus() has to be invoked
              * before setting focus.
              */
-            setXICWindowFocus(pX11IMData->current_ic, XtWindow(cdata->widget));
+            setXICWindowFocus(pX11IMData->current_ic, cdata->widget);
             setXICFocus(pX11IMData->current_ic, True);
         } else {
             destroyX11InputMethodData((JNIEnv *) NULL, pX11IMData);
@@ -1705,7 +1704,7 @@
 
     if (req) {
 #ifdef XAWT
-        if (w == NULL) {
+        if (!w) {
             AWT_UNLOCK();
             return;
         }
@@ -1738,10 +1737,10 @@
 #ifndef XAWT
         w = cdata->widget;
 #endif /* XAWT */
-        setXICWindowFocus(pX11IMData->current_ic, XtWindow(w));
+        setXICWindowFocus(pX11IMData->current_ic, w);
         setXICFocus(pX11IMData->current_ic, req);
         currentX11InputMethodInstance = pX11IMData->x11inputmethod;
-        currentFocusWindow =  XtWindow(w);
+        currentFocusWindow =  w;
 #ifdef __linux__
         if (active && pX11IMData->statusWindow && pX11IMData->statusWindow->on)
             onoffStatusWindow(pX11IMData, w, True);
--- a/src/solaris/native/sun/awt/awt_Robot.c	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/solaris/native/sun/awt/awt_Robot.c	Thu Nov 04 15:38:39 2010 -0700
@@ -165,41 +165,34 @@
 
 // this should be called from XRobotPeer constructor
 JNIEXPORT void JNICALL
-Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls, jint numberOfButtons) {
+Java_sun_awt_X11_XRobotPeer_setup (JNIEnv * env, jclass cls, jint numberOfButtons, jintArray buttonDownMasks)
+{
     int32_t xtestAvailable;
+    jint *tmp;
+    int i;
 
     DTRACE_PRINTLN("RobotPeer: setup()");
 
     num_buttons = numberOfButtons;
-
-    jclass inputEventClazz = (*env)->FindClass(env, "java/awt/event/InputEvent");
-    jmethodID getButtonDownMasksID = (*env)->GetStaticMethodID(env, inputEventClazz, "getButtonDownMasks", "()[I");
-    jintArray obj = (jintArray)(*env)->CallStaticObjectMethod(env, inputEventClazz, getButtonDownMasksID);
-    jint * tmp = (*env)->GetIntArrayElements(env, obj, JNI_FALSE);
-
-    masks  = (jint *)malloc(sizeof(jint) * num_buttons);
+    tmp = (*env)->GetIntArrayElements(env, buttonDownMasks, JNI_FALSE);
+    masks = (jint *)malloc(sizeof(jint) * num_buttons);
     if (masks == (jint *) NULL) {
         JNU_ThrowOutOfMemoryError((JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2), NULL);
-        goto finally;
+        (*env)->ReleaseIntArrayElements(env, buttonDownMasks, tmp, 0);
+        return;
     }
-
-    int i;
     for (i = 0; i < num_buttons; i++) {
         masks[i] = tmp[i];
     }
-    (*env)->ReleaseIntArrayElements(env, obj, tmp, 0);
-    (*env)->DeleteLocalRef(env, obj);
+    (*env)->ReleaseIntArrayElements(env, buttonDownMasks, tmp, 0);
 
     AWT_LOCK();
     xtestAvailable = isXTestAvailable();
     DTRACE_PRINTLN1("RobotPeer: XTest available = %d", xtestAvailable);
     if (!xtestAvailable) {
         JNU_ThrowByName(env, "java/awt/AWTException", "java.awt.Robot requires your X server support the XTEST extension version 2.2");
-        AWT_UNLOCK();
-        return;
     }
 
-    finally:
     AWT_UNLOCK();
 }
 
--- a/src/solaris/native/sun/awt/awt_UNIXToolkit.c	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/solaris/native/sun/awt/awt_UNIXToolkit.c	Thu Nov 04 15:38:39 2010 -0700
@@ -112,7 +112,7 @@
         /* Copy the data array into a Java structure so we can pass it back. */
         jbyteArray data = (*env)->NewByteArray(env, (row_stride * height));
         (*env)->SetByteArrayRegion(env, data, 0, (row_stride * height),
-                                   pixbuf_data);
+                                   (jbyte *)pixbuf_data);
 
         /* Release the pixbuf. */
         (*fp_g_object_unref)(pixbuf);
--- a/src/solaris/native/sun/awt/medialib/mlib_v_ImageLookUpS32S16Func.c	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/solaris/native/sun/awt/medialib/mlib_v_ImageLookUpS32S16Func.c	Thu Nov 04 15:38:39 2010 -0700
@@ -169,7 +169,8 @@
 {
   mlib_s32 *sl;
   mlib_s16 *dl;
-  const mlib_s16 *tab = &table[0][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_s16 *tab = &table[0][shift];
   mlib_s32 j, i;
 
   sl = (void *)src;
@@ -209,6 +210,7 @@
 {
   mlib_s32 *sl;
   mlib_s16 *dl;
+  mlib_u32 shift = 2147483648u;
   const mlib_s16 *tab;
   mlib_s32 j, i;
 
@@ -220,8 +222,8 @@
     mlib_s32 *sp = sl;
     mlib_s16 *dp = dl;
     mlib_s32 off, size = xsize * 2;
-    const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-    const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
+    const mlib_s16 *tab0 = &table[0][shift];
+    const mlib_s16 *tab1 = &table[1][shift];
 
     off = (mlib_s32) (((8 - ((mlib_addr) dp & 7)) & 7) >> 1);
 
@@ -261,6 +263,7 @@
 {
   mlib_s32 *sl;
   mlib_s16 *dl;
+  mlib_u32 shift = 2147483648u;
   const mlib_s16 *tab;
   mlib_s32 j;
 
@@ -271,10 +274,10 @@
   for (j = 0; j < ysize; j++) {
     mlib_s32 *sp = sl;
     mlib_s16 *dp = dl;
-    const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-    const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
-    const mlib_s16 *tab2 = &table[2][(mlib_u32) 2147483648u];
-    const mlib_s16 *tab3 = &table[3][(mlib_u32) 2147483648u];
+    const mlib_s16 *tab0 = &table[0][shift];
+    const mlib_s16 *tab1 = &table[1][shift];
+    const mlib_s16 *tab2 = &table[2][shift];
+    const mlib_s16 *tab3 = &table[3][shift];
     mlib_s32 off, size = xsize * 4;
 
     off = (mlib_s32) (((8 - ((mlib_addr) dp & 7)) & 7) >> 1);
@@ -453,6 +456,7 @@
 {
   mlib_s32 *sl;
   mlib_s16 *dl;
+  mlib_u32 shift = 2147483648u;
   const mlib_s16 *tab;
   mlib_s32 j, i;
 
@@ -463,9 +467,9 @@
   for (j = 0; j < ysize; j++) {
     mlib_s32 *sp = sl;
     mlib_s16 *dp = dl;
-    const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-    const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
-    const mlib_s16 *tab2 = &table[2][(mlib_u32) 2147483648u];
+    const mlib_s16 *tab0 = &table[0][shift];
+    const mlib_s16 *tab1 = &table[1][shift];
+    const mlib_s16 *tab2 = &table[2][shift];
     mlib_s32 off, size = xsize * 3;
 
     off = (mlib_s32) (((8 - ((mlib_addr) dp & 7)) & 7) >> 1);
--- a/src/solaris/native/sun/awt/medialib/mlib_v_ImageLookUpS32U16Func.c	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/solaris/native/sun/awt/medialib/mlib_v_ImageLookUpS32U16Func.c	Thu Nov 04 15:38:39 2010 -0700
@@ -170,7 +170,8 @@
 {
   mlib_s32 *sl;
   mlib_u16 *dl;
-  const mlib_u16 *tab = &table[0][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_u16 *tab = &table[0][shift];
   mlib_s32 j, i;
 
   sl = (void *)src;
@@ -211,6 +212,7 @@
 {
   mlib_s32 *sl;
   mlib_u16 *dl;
+  mlib_u32 shift = 2147483648u;
   const mlib_u16 *tab;
   mlib_s32 j, i;
 
@@ -222,8 +224,8 @@
     mlib_s32 *sp = sl;
     mlib_u16 *dp = dl;
     mlib_s32 off, size = xsize * 2;
-    const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-    const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
+    const mlib_u16 *tab0 = &table[0][shift];
+    const mlib_u16 *tab1 = &table[1][shift];
 
     off = (mlib_s32) (((8 - ((mlib_addr) dp & 7)) & 7) >> 1);
 
@@ -264,6 +266,7 @@
 {
   mlib_s32 *sl;
   mlib_u16 *dl;
+  mlib_u32 shift = 2147483648u;
   const mlib_u16 *tab;
   mlib_s32 j;
 
@@ -274,10 +277,10 @@
   for (j = 0; j < ysize; j++) {
     mlib_s32 *sp = sl;
     mlib_u16 *dp = dl;
-    const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-    const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
-    const mlib_u16 *tab2 = &table[2][(mlib_u32) 2147483648u];
-    const mlib_u16 *tab3 = &table[3][(mlib_u32) 2147483648u];
+    const mlib_u16 *tab0 = &table[0][shift];
+    const mlib_u16 *tab1 = &table[1][shift];
+    const mlib_u16 *tab2 = &table[2][shift];
+    const mlib_u16 *tab3 = &table[3][shift];
     mlib_s32 off, size = xsize * 4;
 
     off = (mlib_s32) (((8 - ((mlib_addr) dp & 7)) & 7) >> 1);
@@ -457,6 +460,7 @@
 {
   mlib_s32 *sl;
   mlib_u16 *dl;
+  mlib_u32 shift = 2147483648u;
   const mlib_u16 *tab;
   mlib_s32 j, i;
 
@@ -467,9 +471,9 @@
   for (j = 0; j < ysize; j++) {
     mlib_s32 *sp = sl;
     mlib_u16 *dp = dl;
-    const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-    const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
-    const mlib_u16 *tab2 = &table[2][(mlib_u32) 2147483648u];
+    const mlib_u16 *tab0 = &table[0][shift];
+    const mlib_u16 *tab1 = &table[1][shift];
+    const mlib_u16 *tab2 = &table[2][shift];
     mlib_s32 off, size = xsize * 3;
 
     off = (mlib_s32) (((8 - ((mlib_addr) dp & 7)) & 7) >> 1);
--- a/src/solaris/native/sun/awt/medialib/mlib_v_ImageLookUpSIS32S16Func.c	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/solaris/native/sun/awt/medialib/mlib_v_ImageLookUpSIS32S16Func.c	Thu Nov 04 15:38:39 2010 -0700
@@ -81,8 +81,9 @@
   mlib_d64 t0, t1, t2;                 /* destination data */
   mlib_d64 t3, acc;                    /* destination data */
   mlib_s32 i;                          /* loop variable */
-  const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_s16 *tab0 = &table[0][shift];
+  const mlib_s16 *tab1 = &table[1][shift];
 
   sp = (void *)src;
   dl = dst;
@@ -145,8 +146,9 @@
   mlib_d64 t0, t1, t2;                 /* destination data */
   mlib_d64 t3, acc;                    /* destination data */
   mlib_s32 i;                          /* loop variable */
-  const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_s16 *tab0 = &table[0][shift];
+  const mlib_s16 *tab1 = &table[1][shift];
 
   sp = (void *)src;
   dl = dst;
@@ -220,8 +222,9 @@
   mlib_s32 *sl;
   mlib_s16 *dl;
   mlib_s32 j;
-  const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_s16 *tab0 = &table[0][shift];
+  const mlib_s16 *tab1 = &table[1][shift];
 
   sl = (void *)src;
   dl = dst;
@@ -268,9 +271,10 @@
   mlib_d64 t0, t1, t2, t3;             /* destination data */
   mlib_d64 acc0, acc1, acc2;           /* destination data */
   mlib_s32 i;                          /* loop variable */
-  const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab2 = &table[2][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_s16 *tab0 = &table[0][shift];
+  const mlib_s16 *tab1 = &table[1][shift];
+  const mlib_s16 *tab2 = &table[2][shift];
   mlib_s32 s00, s01, s02, s03;
 
   sp = (void *)src;
@@ -379,9 +383,10 @@
   mlib_s32 *sl;
   mlib_s16 *dl;
   mlib_s32 i, j;
-  const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab2 = &table[2][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_s16 *tab0 = &table[0][shift];
+  const mlib_s16 *tab1 = &table[1][shift];
+  const mlib_s16 *tab2 = &table[2][shift];
 
   sl = (void *)src;
   dl = dst;
@@ -425,10 +430,11 @@
   mlib_d64 t0, t1, t2, t3;             /* destination data */
   mlib_d64 acc;                        /* destination data */
   mlib_s32 i;                          /* loop variable */
-  const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab2 = &table[2][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab3 = &table[3][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_s16 *tab0 = &table[0][shift];
+  const mlib_s16 *tab1 = &table[1][shift];
+  const mlib_s16 *tab2 = &table[2][shift];
+  const mlib_s16 *tab3 = &table[3][shift];
 
   sp = (void *)src;
   dl = dst;
@@ -479,10 +485,11 @@
   mlib_d64 t0, t1, t2, t3;             /* destination data */
   mlib_d64 acc;                        /* destination data */
   mlib_s32 i;                          /* loop variable */
-  const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab2 = &table[2][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab3 = &table[3][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_s16 *tab0 = &table[0][shift];
+  const mlib_s16 *tab1 = &table[1][shift];
+  const mlib_s16 *tab2 = &table[2][shift];
+  const mlib_s16 *tab3 = &table[3][shift];
 
   sp = (void *)src;
   dl = dst;
@@ -543,10 +550,11 @@
   mlib_d64 t0, t1, t2, t3;             /* destination data */
   mlib_d64 acc;                        /* destination data */
   mlib_s32 i;                          /* loop variable */
-  const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab2 = &table[2][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab3 = &table[3][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_s16 *tab0 = &table[0][shift];
+  const mlib_s16 *tab1 = &table[1][shift];
+  const mlib_s16 *tab2 = &table[2][shift];
+  const mlib_s16 *tab3 = &table[3][shift];
 
   sp = (void *)src;
   dl = dst;
@@ -606,10 +614,11 @@
   mlib_d64 t0, t1, t2, t3;             /* destination data */
   mlib_d64 acc;                        /* destination data */
   mlib_s32 i;                          /* loop variable */
-  const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab2 = &table[2][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab3 = &table[3][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_s16 *tab0 = &table[0][shift];
+  const mlib_s16 *tab1 = &table[1][shift];
+  const mlib_s16 *tab2 = &table[2][shift];
+  const mlib_s16 *tab3 = &table[3][shift];
 
   sp = (void *)src;
   dl = dst;
@@ -667,9 +676,10 @@
   mlib_s32 *sl;
   mlib_s16 *dl;
   mlib_s32 j;
-  const mlib_s16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab1 = &table[1][(mlib_u32) 2147483648u];
-  const mlib_s16 *tab2 = &table[2][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_s16 *tab0 = &table[0][shift];
+  const mlib_s16 *tab1 = &table[1][shift];
+  const mlib_s16 *tab2 = &table[2][shift];
 
   sl = (void *)src;
   dl = dst;
--- a/src/solaris/native/sun/awt/medialib/mlib_v_ImageLookUpSIS32U16Func.c	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/solaris/native/sun/awt/medialib/mlib_v_ImageLookUpSIS32U16Func.c	Thu Nov 04 15:38:39 2010 -0700
@@ -81,8 +81,9 @@
   mlib_d64 t0, t1, t2;                 /* destination data */
   mlib_d64 t3, acc;                    /* destination data */
   mlib_s32 i;                          /* loop variable */
-  const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_u16 *tab0 = &table[0][shift];
+  const mlib_u16 *tab1 = &table[1][shift];
 
   sp = (void *)src;
   dl = dst;
@@ -145,8 +146,9 @@
   mlib_d64 t0, t1, t2;                 /* destination data */
   mlib_d64 t3, acc;                    /* destination data */
   mlib_s32 i;                          /* loop variable */
-  const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_u16 *tab0 = &table[0][shift];
+  const mlib_u16 *tab1 = &table[1][shift];
 
   sp = (void *)src;
   dl = dst;
@@ -220,8 +222,9 @@
   mlib_s32 *sl;
   mlib_u16 *dl;
   mlib_s32 j;
-  const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_u16 *tab0 = &table[0][shift];
+  const mlib_u16 *tab1 = &table[1][shift];
 
   sl = (void *)src;
   dl = dst;
@@ -268,9 +271,10 @@
   mlib_d64 t0, t1, t2, t3;             /* destination data */
   mlib_d64 acc0, acc1, acc2;           /* destination data */
   mlib_s32 i;                          /* loop variable */
-  const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab2 = &table[2][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_u16 *tab0 = &table[0][shift];
+  const mlib_u16 *tab1 = &table[1][shift];
+  const mlib_u16 *tab2 = &table[2][shift];
   mlib_s32 s00, s01, s02, s03;
 
   sp = (void *)src;
@@ -379,9 +383,10 @@
   mlib_s32 *sl;
   mlib_u16 *dl;
   mlib_s32 i, j;
-  const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab2 = &table[2][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_u16 *tab0 = &table[0][shift];
+  const mlib_u16 *tab1 = &table[1][shift];
+  const mlib_u16 *tab2 = &table[2][shift];
 
   sl = (void *)src;
   dl = dst;
@@ -425,10 +430,11 @@
   mlib_d64 t0, t1, t2, t3;             /* destination data */
   mlib_d64 acc;                        /* destination data */
   mlib_s32 i;                          /* loop variable */
-  const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab2 = &table[2][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab3 = &table[3][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_u16 *tab0 = &table[0][shift];
+  const mlib_u16 *tab1 = &table[1][shift];
+  const mlib_u16 *tab2 = &table[2][shift];
+  const mlib_u16 *tab3 = &table[3][shift];
 
   sp = (void *)src;
   dl = dst;
@@ -479,10 +485,11 @@
   mlib_d64 t0, t1, t2, t3;             /* destination data */
   mlib_d64 acc;                        /* destination data */
   mlib_s32 i;                          /* loop variable */
-  const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab2 = &table[2][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab3 = &table[3][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_u16 *tab0 = &table[0][shift];
+  const mlib_u16 *tab1 = &table[1][shift];
+  const mlib_u16 *tab2 = &table[2][shift];
+  const mlib_u16 *tab3 = &table[3][shift];
 
   sp = (void *)src;
   dl = dst;
@@ -543,10 +550,11 @@
   mlib_d64 t0, t1, t2, t3;             /* destination data */
   mlib_d64 acc;                        /* destination data */
   mlib_s32 i;                          /* loop variable */
-  const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab2 = &table[2][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab3 = &table[3][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_u16 *tab0 = &table[0][shift];
+  const mlib_u16 *tab1 = &table[1][shift];
+  const mlib_u16 *tab2 = &table[2][shift];
+  const mlib_u16 *tab3 = &table[3][shift];
 
   sp = (void *)src;
   dl = dst;
@@ -606,10 +614,11 @@
   mlib_d64 t0, t1, t2, t3;             /* destination data */
   mlib_d64 acc;                        /* destination data */
   mlib_s32 i;                          /* loop variable */
-  const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab2 = &table[2][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab3 = &table[3][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_u16 *tab0 = &table[0][shift];
+  const mlib_u16 *tab1 = &table[1][shift];
+  const mlib_u16 *tab2 = &table[2][shift];
+  const mlib_u16 *tab3 = &table[3][shift];
 
   sp = (void *)src;
   dl = dst;
@@ -667,9 +676,10 @@
   mlib_s32 *sl;
   mlib_u16 *dl;
   mlib_s32 j;
-  const mlib_u16 *tab0 = &table[0][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab1 = &table[1][(mlib_u32) 2147483648u];
-  const mlib_u16 *tab2 = &table[2][(mlib_u32) 2147483648u];
+  mlib_u32 shift = 2147483648u;
+  const mlib_u16 *tab0 = &table[0][shift];
+  const mlib_u16 *tab1 = &table[1][shift];
+  const mlib_u16 *tab2 = &table[2][shift];
 
   sl = (void *)src;
   dl = dst;
--- a/src/solaris/native/sun/xawt/XlibWrapper.c	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/solaris/native/sun/xawt/XlibWrapper.c	Thu Nov 04 15:38:39 2010 -0700
@@ -484,8 +484,8 @@
 (JNIEnv *env, jclass clazz, jlong lib_major_in_out, jlong lib_minor_in_out)
 {
     AWT_CHECK_HAVE_LOCK();
-    *((int *)lib_major_in_out) =  XkbMajorVersion;
-    *((int *)lib_minor_in_out) =  XkbMinorVersion;
+    *((int *)jlong_to_ptr(lib_major_in_out)) =  XkbMajorVersion;
+    *((int *)jlong_to_ptr(lib_minor_in_out)) =  XkbMinorVersion;
     return  XkbLibraryVersion((int *)jlong_to_ptr(lib_major_in_out), (int *)jlong_to_ptr(lib_minor_in_out));
 }
 
@@ -1229,7 +1229,6 @@
 (JNIEnv *env, jclass clazz, jlong display)
 {
     int xx;
-    AWT_CHECK_HAVE_LOCK();
     static jboolean result = JNI_FALSE;
 
     int32_t minKeyCode, maxKeyCode, keySymsPerKeyCode;
@@ -1237,6 +1236,8 @@
     int32_t i;
     int32_t kanaCount = 0;
 
+    AWT_CHECK_HAVE_LOCK();
+
     // There's no direct way to determine whether the keyboard has
     // a kana lock key. From available keyboard mapping tables, it looks
     // like only keyboards with the kana lock key can produce keysyms
@@ -1337,12 +1338,14 @@
 JNIEXPORT jint JNICALL Java_sun_awt_X11_XlibWrapper_XInternAtoms
 (JNIEnv *env, jclass clazz, jlong display, jobjectArray names_arr, jboolean only_if_exists, jlong atoms)
 {
-
     int length = (*env)->GetArrayLength(env, names_arr);
     char ** names = (char**)malloc(length*sizeof(char*));
     jboolean copy;
     int index, name_index = 0;
     int status;
+
+    AWT_CHECK_HAVE_LOCK();
+
     for (index = 0; index < length; index++) {
         jstring str = (*env)->GetObjectArrayElement(env, names_arr, index);
         if (!JNU_IsNull(env, str)) {
@@ -1352,7 +1355,6 @@
             (*env)->DeleteLocalRef(env, str);
         }
     }
-    AWT_CHECK_HAVE_LOCK();
     status = XInternAtoms((Display*)jlong_to_ptr(display), names, name_index, only_if_exists, (Atom*) jlong_to_ptr(atoms));
     for (index = 0; index < length; index++) {
         free(names[index]);
@@ -2186,12 +2188,12 @@
 Java_sun_awt_X11_XlibWrapper_SetZOrder
 (JNIEnv *env, jclass clazz, jlong display, jlong window, jlong above)
 {
-    AWT_CHECK_HAVE_LOCK();
+    unsigned int value_mask = CWStackMode;
 
     XWindowChanges wc;
     wc.sibling = (Window)jlong_to_ptr(above);
 
-    unsigned int value_mask = CWStackMode;
+    AWT_CHECK_HAVE_LOCK();
 
     if (above == 0) {
         wc.stack_mode = Above;
@@ -2219,6 +2221,7 @@
     jboolean isCopy = JNI_FALSE;
     size_t worstBufferSize = (size_t)((width / 2 + 1) * height);
     RECT_T * pRect;
+    int numrects;
 
     AWT_CHECK_HAVE_LOCK();
 
@@ -2237,7 +2240,7 @@
     /* Note: the values[0] and values[1] are supposed to contain the width
      * and height (see XIconInfo.getIntData() for details). So, we do +2.
      */
-    int numrects = BitmapToYXBandedRectangles(32, (int)width, (int)height,
+    numrects = BitmapToYXBandedRectangles(32, (int)width, (int)height,
             (unsigned char *)(values + 2), pRect);
 
     XShapeCombineRectangles((Display *)jlong_to_ptr(display), (Window)jlong_to_ptr(window),
--- a/src/solaris/native/sun/xawt/awt_Desktop.c	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/solaris/native/sun/xawt/awt_Desktop.c	Thu Nov 04 15:38:39 2010 -0700
@@ -28,12 +28,15 @@
 
 typedef int gboolean;
 
-gboolean (*gnome_url_show) (const char *url, void **error);
+typedef gboolean (GNOME_URL_SHOW_TYPE)(const char *, void **);
+typedef gboolean (GNOME_VFS_INIT_TYPE)(void);
+
+GNOME_URL_SHOW_TYPE *gnome_url_show;
+GNOME_VFS_INIT_TYPE *gnome_vfs_init;
 
 int init(){
     void *vfs_handle;
     void *gnome_handle;
-    gboolean (*gnome_vfs_init) (void);
     const char *errmsg;
 
     vfs_handle = dlopen("libgnomevfs-2.so.0", RTLD_LAZY);
@@ -44,7 +47,7 @@
         return 0;
     }
     dlerror(); /* Clear errors */
-    gnome_vfs_init = dlsym(vfs_handle, "gnome_vfs_init");
+    gnome_vfs_init = (GNOME_VFS_INIT_TYPE*)dlsym(vfs_handle, "gnome_vfs_init");
     if ((errmsg = dlerror()) != NULL) {
 #ifdef INTERNAL_BUILD
         fprintf(stderr, "can not find symble gnome_vfs_init\n");
@@ -62,7 +65,7 @@
         return 0;
     }
     dlerror(); /* Clear errors */
-    gnome_url_show = dlsym(gnome_handle, "gnome_url_show");
+    gnome_url_show = (GNOME_URL_SHOW_TYPE*)dlsym(gnome_handle, "gnome_url_show");
     if ((errmsg = dlerror()) != NULL) {
 #ifdef INTERNAL_BUILD
         fprintf(stderr, "can not find symble gnome_url_show\n");
@@ -94,14 +97,15 @@
   (JNIEnv *env, jobject obj, jbyteArray url_j)
 {
     gboolean success;
+    const char* url_c;
 
-    const char* url_c = (*env)->GetByteArrayElements(env, url_j, NULL);
+    if (gnome_url_show == NULL) {
+        return JNI_FALSE;
+    }
 
-    if (gnome_url_show == NULL) return JNI_FALSE;
-
+    url_c = (char*)(*env)->GetByteArrayElements(env, url_j, NULL);
     // call gnome_url_show(const char* , GError**)
     success = (*gnome_url_show)(url_c, NULL);
-
     (*env)->ReleaseByteArrayElements(env, url_j, (signed char*)url_c, 0);
 
     return success ? JNI_TRUE : JNI_FALSE;
--- a/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java	Thu Nov 04 15:38:39 2010 -0700
@@ -33,6 +33,7 @@
 import java.awt.color.*;
 import java.awt.image.*;
 import sun.awt.image.ByteInterleavedRaster;
+import sun.security.action.GetPropertyAction;
 import java.lang.reflect.*;
 
 public class WEmbeddedFrame extends EmbeddedFrame {
@@ -48,8 +49,12 @@
     private int imgWid = 0;
     private int imgHgt = 0;
 
+    private static int pScale = 0;
     private static final int MAX_BAND_SIZE = (1024*30);
 
+    private static String printScale = (String) java.security.AccessController
+       .doPrivileged(new GetPropertyAction("sun.java2d.print.pluginscalefactor"));
+
     public WEmbeddedFrame() {
         this((long)0);
     }
@@ -114,8 +119,7 @@
          * real resolution of the destination so
          */
         if (isPrinterDC(hdc)) {
-            xscale = 4;
-            yscale = 4;
+            xscale = yscale = getPrintScaleFactor();
         }
 
         int frameHeight = getHeight();
@@ -168,6 +172,37 @@
         }
     }
 
+    protected static int getPrintScaleFactor() {
+        // check if value is already cached
+        if (pScale != 0)
+            return pScale;
+        if (printScale == null) {
+            // if no system property is specified,
+            // check for environment setting
+            printScale = (String) java.security.AccessController.doPrivileged(
+                new java.security.PrivilegedAction() {
+                    public Object run() {
+                        return System.getenv("JAVA2D_PLUGIN_PRINT_SCALE");
+                    }
+                }
+            );
+        }
+        int default_printDC_scale = 4;
+        int scale = default_printDC_scale;
+        if (printScale != null) {
+            try {
+                scale = Integer.parseInt(printScale);
+                if (scale > 8 || scale < 1) {
+                    scale = default_printDC_scale;
+                }
+            } catch (NumberFormatException nfe) {
+            }
+        }
+        pScale = scale;
+        return pScale;
+    }
+
+
     protected native boolean isPrinterDC(long hdc);
 
     protected native void printBand(long hdc, byte[] data, int offset,
--- a/src/windows/classes/sun/awt/windows/WWindowPeer.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/windows/classes/sun/awt/windows/WWindowPeer.java	Thu Nov 04 15:38:39 2010 -0700
@@ -487,13 +487,8 @@
             newDev.addDisplayChangedListener(this);
         }
 
-        SunToolkit.executeOnEventHandlerThread((Component)target,
-                new Runnable() {
-                    public void run() {
-                        AWTAccessor.getComponentAccessor().
+        AWTAccessor.getComponentAccessor().
             setGraphicsConfiguration((Component)target, winGraphicsConfig);
-                    }
-                });
     }
 
     /**
--- a/src/windows/native/sun/windows/WPrinterJob.cpp	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/windows/native/sun/windows/WPrinterJob.cpp	Thu Nov 04 15:38:39 2010 -0700
@@ -639,7 +639,7 @@
     if( ::ExtEscape( hDC, GETTECHNOLOGY, 0, NULL, MAX_PATH,
                      (LPSTR)szTechnology ) <= 0 )
         return FALSE;
-    strupr( szTechnology );
+    _strupr_s(szTechnology, MAX_PATH);
     if(!strstr( szTechnology, "POSTSCRIPT" ) == NULL )
         return TRUE;
 
--- a/src/windows/native/sun/windows/awt_BitmapUtil.cpp	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/windows/native/sun/windows/awt_BitmapUtil.cpp	Thu Nov 04 15:38:39 2010 -0700
@@ -246,7 +246,7 @@
     UINT height = abs(bi.bmiHeader.biHeight);
 
     BYTE * buf = (BYTE*)safe_Malloc(bi.bmiHeader.biSizeImage);
-    bi.bmiHeader.biHeight = -height;
+    bi.bmiHeader.biHeight = -(INT)height;
     ::GetDIBits(hdc, hBitmap, 0, height, buf,
             reinterpret_cast<BITMAPINFO*>(&bi), DIB_RGB_COLORS);
 
@@ -305,7 +305,7 @@
     UINT height = abs(bi.bmiHeader.biHeight);
 
     BYTE * buf = (BYTE*)safe_Malloc(bi.bmiHeader.biSizeImage);
-    bi.bmiHeader.biHeight = -height;
+    bi.bmiHeader.biHeight = -(INT)height;
     ::GetDIBits(hdc, hSrcBitmap, 0, height, buf,
             reinterpret_cast<BITMAPINFO*>(&bi), DIB_RGB_COLORS);
 
--- a/src/windows/native/sun/windows/awt_DesktopProperties.cpp	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/windows/native/sun/windows/awt_DesktopProperties.cpp	Thu Nov 04 15:38:39 2010 -0700
@@ -238,7 +238,7 @@
     // when running on XP. However this can't be referenced at compile time
     // with the older SDK, so there use 'lfMessageFont' plus its size.
     if (!IS_WINVISTA) {
-#if defined(_MSC_VER) && (_MSC_VER >= 1600) {
+#if defined(_MSC_VER) && (_MSC_VER >= 1600)
         ncmetrics.cbSize = offsetof(NONCLIENTMETRICS, iPaddedBorderWidth);
 #else
         ncmetrics.cbSize = offsetof(NONCLIENTMETRICS,lfMessageFont) + sizeof(LOGFONT);
--- a/src/windows/native/sun/windows/awt_Dialog.cpp	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/windows/native/sun/windows/awt_Dialog.cpp	Thu Nov 04 15:38:39 2010 -0700
@@ -304,7 +304,15 @@
     UINT flags = SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE;
 
     if (isBlocked) {
-        ::SetWindowPos(dialog, blocker, 0, 0, 0, 0, flags);
+        // Fix for 6829546: if blocker is a top-most window, but window isn't, then
+        // calling ::SetWindowPos(dialog, blocker, ...) makes window top-most as well
+        BOOL isBlockerTopmost = (::GetWindowLong(blocker, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
+        BOOL isDialogTopmost = (::GetWindowLong(dialog, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0;
+        if (!isBlockerTopmost || isDialogTopmost) {
+            ::SetWindowPos(dialog, blocker, 0, 0, 0, 0, flags);
+        } else {
+            ::SetWindowPos(dialog, HWND_TOP, 0, 0, 0, 0, flags);
+        }
     } else {
         ::SetWindowPos(dialog, HWND_TOP, 0, 0, 0, 0, flags);
         // no beep/flash if the mouse was clicked in the taskbar menu
--- a/src/windows/native/sun/windows/awt_DrawingSurface.h	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/windows/native/sun/windows/awt_DrawingSurface.h	Thu Nov 04 15:38:39 2010 -0700
@@ -159,7 +159,8 @@
     void JNICALL DSUnlockAWT(JNIEnv* env);
 
     _JNI_IMPORT_OR_EXPORT_
-    jobject JNICALL DSGetComponent(JNIEnv* env, void* platformInfo);
+    jobject JNICALL DSGetComponent(
+        JNIEnv* env, void* platformInfo);
 
 #ifdef __cplusplus
 } /* extern "C" */
--- a/src/windows/native/sun/windows/awt_Font.cpp	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/windows/native/sun/windows/awt_Font.cpp	Thu Nov 04 15:38:39 2010 -0700
@@ -1189,7 +1189,7 @@
 
 AwtFontCache::Item::Item(const WCHAR* s, HFONT f, AwtFontCache::Item* n )
 {
-    name = wcsdup(s);
+    name = _wcsdup(s);
     font = f;
     next = n;
     refCount = 1;
@@ -1237,7 +1237,7 @@
         free(m_lpszFontName);
         m_lpszFontName = NULL;
     }
-    m_lpszFontName = wcsdup(name);
+    m_lpszFontName = _wcsdup(name);
     DASSERT(m_lpszFontName);
 }
 
--- a/src/windows/native/sun/windows/awt_PrintJob.cpp	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/windows/native/sun/windows/awt_PrintJob.cpp	Thu Nov 04 15:38:39 2010 -0700
@@ -1050,7 +1050,7 @@
     return NULL;
   }
 
-  LPTSTR port = wcsdup(info2->pPortName);
+  LPTSTR port = _wcsdup(info2->pPortName);
   ::GlobalFree(info2);
   return port;
 }
--- a/src/windows/native/sun/windows/awt_Toolkit.cpp	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/windows/native/sun/windows/awt_Toolkit.cpp	Thu Nov 04 15:38:39 2010 -0700
@@ -23,16 +23,12 @@
  * questions.
  */
 
+#define _JNI_IMPLEMENTATION_
+
 #include "awt.h"
 #include <signal.h>
 #include <windowsx.h>
 
-//#if defined(_DEBUG) && defined(_MSC_VER) && _MSC_VER >= 1000
-//#include <crtdbg.h>
-//#endif
-
-#define _JNI_IMPLEMENTATION_
-
 #include "awt_DrawingSurface.h"
 #include "awt_AWTEvent.h"
 #include "awt_Component.h"
@@ -2224,21 +2220,21 @@
     WCHAR szVer[128];
 
     DWORD version = ::GetVersion();
-    swprintf(szVer, L"0x%x = %ld", version, version);
+    swprintf(szVer, 128, L"0x%x = %ld", version, version);
     int l = lstrlen(szVer);
 
     if (IS_WIN2000) {
         if (IS_WINXP) {
             if (IS_WINVISTA) {
-                swprintf(szVer + l, L" (Windows Vista)");
+                swprintf(szVer + l, 128, L" (Windows Vista)");
             } else {
-                swprintf(szVer + l, L" (Windows XP)");
+                swprintf(szVer + l, 128, L" (Windows XP)");
             }
         } else {
-            swprintf(szVer + l, L" (Windows 2000)");
+            swprintf(szVer + l, 128, L" (Windows 2000)");
         }
     } else {
-        swprintf(szVer + l, L" (Unknown)");
+        swprintf(szVer + l, 128, L" (Unknown)");
     }
 
     return JNU_NewStringPlatform(env, szVer);
--- a/src/windows/native/sun/windows/awt_Win32GraphicsEnv.cpp	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/windows/native/sun/windows/awt_Win32GraphicsEnv.cpp	Thu Nov 04 15:38:39 2010 -0700
@@ -269,7 +269,7 @@
         //if the fontPath includes %SystemRoot%
         LPWSTR systemRoot = _wgetenv(L"SystemRoot");
         if (systemRoot != NULL
-            && swprintf(tmpPath, L"%s%s", systemRoot, fontPath + 12) != -1) {
+            && swprintf(tmpPath, MAX_PATH, L"%s%s", systemRoot, fontPath + 12) != -1) {
             fontPath = tmpPath;
         }
         else {
@@ -279,7 +279,7 @@
         //else to see if it only inludes "EUDC.TTE"
         WCHAR systemRoot[MAX_PATH + 1];
         if (GetWindowsDirectory(systemRoot, MAX_PATH + 1) != 0) {
-            swprintf(tmpPath, L"%s\\FONTS\\EUDC.TTE", systemRoot);
+            swprintf(tmpPath, MAX_PATH, L"%s\\FONTS\\EUDC.TTE", systemRoot);
             fontPath = tmpPath;
         }
         else {
--- a/src/windows/native/sun/windows/awt_Window.cpp	Tue Nov 02 15:04:13 2010 +0000
+++ b/src/windows/native/sun/windows/awt_Window.cpp	Thu Nov 04 15:38:39 2010 -0700
@@ -219,7 +219,7 @@
 
     ::InitializeCriticalSection(&contentBitmapCS);
 
-    m_windowType = Type::NORMAL;
+    m_windowType = NORMAL;
     m_alwaysOnTop = false;
 }
 
@@ -1016,9 +1016,9 @@
     }
 
     if (strcmp(valueNative, "UTILITY") == 0) {
-        m_windowType = Type::UTILITY;
+        m_windowType = UTILITY;
     } else if (strcmp(valueNative, "POPUP") == 0) {
-        m_windowType = Type::POPUP;
+        m_windowType = POPUP;
     }
 
     env->ReleaseStringUTFChars(value, valueNative);
@@ -1029,10 +1029,10 @@
 void AwtWindow::TweakStyle(DWORD & style, DWORD & exStyle)
 {
     switch (GetType()) {
-        case Type::UTILITY:
+        case UTILITY:
             exStyle |= WS_EX_TOOLWINDOW;
             break;
-        case Type::POPUP:
+        case POPUP:
             style &= ~WS_OVERLAPPED;
             style |= WS_POPUP;
             break;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java	Thu Nov 04 15:38:39 2010 -0700
@@ -0,0 +1,131 @@
+/*
+ * 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 6829546
+  @summary tests that an always-on-top modal dialog doesn't make any windows always-on-top
+  @author artem.ananiev: area=awt.modal
+  @library ../../regtesthelpers
+  @build Util
+  @run main MakeWindowAlwaysOnTop
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+
+import test.java.awt.regtesthelpers.Util;
+
+public class MakeWindowAlwaysOnTop
+{
+    private static Frame f;
+    private static Dialog d;
+
+    public static void main(String[] args) throws Exception
+    {
+        Robot r = Util.createRobot();
+        Util.waitForIdle(r);
+
+        // Frame
+        f = new Frame("Test frame");
+        f.setBounds(100, 100, 400, 300);
+        f.setBackground(Color.RED);
+        f.setVisible(true);
+        r.delay(100);
+        Util.waitForIdle(r);
+
+        // Dialog
+        d = new Dialog(null, "Modal dialog", Dialog.ModalityType.APPLICATION_MODAL);
+        d.setBounds(500, 500, 160, 160);
+        d.setAlwaysOnTop(true);
+        EventQueue.invokeLater(new Runnable()
+        {
+            public void run()
+            {
+                d.setVisible(true);
+            }
+        });
+        // Wait until the dialog is shown
+        EventQueue.invokeAndWait(new Runnable()
+        {
+            public void run()
+            {
+                // Empty
+            }
+        });
+        r.delay(100);
+        Util.waitForIdle(r);
+
+        // Click on the frame to trigger modality
+        Point p = f.getLocationOnScreen();
+        r.mouseMove(p.x + f.getWidth() / 2, p.y + f.getHeight() / 2);
+        Util.waitForIdle(r);
+        r.mousePress(InputEvent.BUTTON1_MASK);
+        Util.waitForIdle(r);
+        r.mouseRelease(InputEvent.BUTTON1_MASK);
+        Util.waitForIdle(r);
+
+        r.delay(100);
+        Util.waitForIdle(r);
+
+        // Dispose dialog
+        d.dispose();
+        r.delay(100);
+        Util.waitForIdle(r);
+
+        // Show another frame at the same location
+        Frame t = new Frame("Check");
+        t.setBounds(100, 100, 400, 300);
+        t.setBackground(Color.BLUE);
+        t.setVisible(true);
+        r.delay(100);
+        Util.waitForIdle(r);
+
+        // Bring it above the first frame
+        t.toFront();
+        r.delay(100);
+        Util.waitForIdle(r);
+
+        Color c = r.getPixelColor(p.x + f.getWidth() / 2, p.y + f.getHeight() / 2);
+        System.out.println("Color = " + c);
+        System.out.flush();
+        // If the color is RED, then the first frame is now always-on-top
+        if (Color.RED.equals(c))
+        {
+            throw new RuntimeException("Test FAILED: the frame is always-on-top");
+        }
+        else if (!Color.BLUE.equals(c))
+        {
+            throw new RuntimeException("Test FAILED: unknown window is on top of the frame");
+        }
+        else
+        {
+            System.out.println("Test PASSED");
+            System.out.flush();
+        }
+
+        // Dispose all the windows
+        t.dispose();
+        f.dispose();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Frame/FrameLocation/FrameLocation.java	Thu Nov 04 15:38:39 2010 -0700
@@ -0,0 +1,68 @@
+/*
+ * 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 6895647
+  @summary X11 Frame locations should be what we set them to
+  @author anthony.petrov@oracle.com: area=awt.toplevel
+  @run main FrameLocation
+ */
+
+import java.awt.*;
+
+public class FrameLocation {
+    private static final int X = 250;
+    private static final int Y = 250;
+
+    public static void main(String[] args) {
+        Frame f = new Frame("test");
+        f.setBounds(X, Y, 250, 250); // the size doesn't matter
+        f.setVisible(true);
+
+        for (int i = 0; i < 10; i++) {
+            // 2 seconds must be enough for the WM to show the window
+            try {
+                Thread.sleep(2000);
+            } catch (InterruptedException ex) {
+            }
+
+            // Check the location
+            int x = f.getX();
+            int y = f.getY();
+
+            if (x != X || y != Y) {
+                throw new RuntimeException("The frame location is wrong! Current: " + x + ", " + y + ";  expected: " + X + ", " + Y);
+            }
+
+            // Emulate what happens when setGraphicsConfiguration() is called
+            synchronized (f.getTreeLock()) {
+                f.removeNotify();
+                f.addNotify();
+            }
+        }
+
+        f.dispose();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Multiscreen/TranslucencyThrowsExceptionWhenFullScreen/TranslucencyThrowsExceptionWhenFullScreen.java	Thu Nov 04 15:38:39 2010 -0700
@@ -0,0 +1,70 @@
+/*
+ * 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 6838089
+  @summary Translucent windows should throw exception in FS mode
+  @author dmitry.cherepanov@oracle.com: area=awt-multiscreen
+  @run main TranslucencyThrowsExceptionWhenFullScreen
+*/
+
+import java.awt.*;
+import java.lang.reflect.InvocationTargetException;
+
+public class TranslucencyThrowsExceptionWhenFullScreen
+{
+    public static void main(String[] args)
+        throws InvocationTargetException, InterruptedException
+    {
+        EventQueue.invokeAndWait(
+            new Runnable(){
+                public void run() {
+                    Frame frame = new Frame();
+                    frame.setBounds(100,100,100,100);
+                    frame.setVisible(true);
+
+                    GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
+                    GraphicsDevice[] devices = ge.getScreenDevices();
+                    for (GraphicsDevice device : devices) {
+                        testGraphicsDevice(device, frame);
+                    }
+
+                    frame.dispose();
+                }
+            }
+        );
+    }
+
+    private static void testGraphicsDevice(GraphicsDevice device, Frame frame) {
+        device.setFullScreenWindow(frame);
+        try {
+            frame.setOpacity(0.5f);
+            throw new RuntimeException("Test fails, there's no exception for device="+device);
+        } catch(IllegalComponentStateException e) {
+            device.setFullScreenWindow(null);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/image/GetDataElementsTest.java	Thu Nov 04 15:38:39 2010 -0700
@@ -0,0 +1,62 @@
+/*
+ * 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     6773022
+ * @summary Test verifies that SampleModel.getDataElements() throws an appropriate
+ *           exception if coordinates are not in bounds.
+ *
+ * @run     main GetDataElementsTest
+ */
+
+import java.awt.image.ComponentSampleModel;
+import java.awt.image.DataBuffer;
+import java.awt.image.SampleModel;
+
+public class GetDataElementsTest {
+
+    public static int width = 100;
+    public static int height = 100;
+    public static int dataType = DataBuffer.TYPE_BYTE;
+    public static int numBands = 4;
+
+    public static void main(String[] args) {
+        SampleModel sm = new ComponentSampleModel(dataType, width, height, 4, width * 4, new int[] { 0, 1, 2, 3 } );
+
+        DataBuffer db = sm.createDataBuffer();
+        Object o = null;
+
+        boolean testPassed = false;
+        try {
+            o = sm.getDataElements(Integer.MAX_VALUE, 0, 1, 1, o, db);
+        } catch (ArrayIndexOutOfBoundsException e) {
+            System.out.println(e.getMessage());
+            testPassed = true;
+        }
+
+        if (!testPassed) {
+            throw new RuntimeException("Excpected excprion was not thrown.");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/text/Collator/Bug6970930.java	Thu Nov 04 15:38:39 2010 -0700
@@ -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 6970930
+ * @summary verify that compare() throws NPE instead of IAE when an argument is null.
+ */
+import java.text.*;
+
+public class Bug6970930 {
+
+    private static boolean err = false;
+
+    public static void main(String[] args) {
+        // Check if compare() throws NPE.
+        test1(null, null);
+        test1("\"foo\"", null);
+        test1(null, "\"bar\"");
+
+        if (err) {
+            throw new RuntimeException("Failed.");
+        } else {
+            System.out.println("Passed.");
+        }
+    }
+
+    private static void test1(String s1, String s2) {
+        RuleBasedCollator col = null;
+
+        try {
+            col = new RuleBasedCollator("< a < b");
+        }
+        catch (ParseException e) {
+            err = true;
+            System.err.println(e);
+        }
+
+        try {
+            col.compare("foo", "bar"); // This line is necessary to reproduce the bug.
+            col.compare(s1, s2);
+
+            err = true;
+            System.err.println("No exception was thrown for compare(" +
+                               s1 + ", " +  s2 + ").");
+        }
+        catch (NullPointerException e) {
+            System.out.println("NPE was thrown as expected for compare(" +
+                               s1 + ", " + s2 + ").");
+        }
+        catch (Exception e) {
+            err = true;
+            System.err.println("Unexpected exception was thrown for compare(" +
+                               s1 + ", " + s2 + "): " + e);
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/util/Locale/Bug6989440.java	Thu Nov 04 15:38:39 2010 -0700
@@ -0,0 +1,62 @@
+/*
+ * 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 6989440
+ * @summary Verify ConcurrentModificationException is not thrown with multiple
+ *     thread accesses.
+ * @compile -XDignore.symbol.file=true Bug6989440.java
+ * @run main Bug6989440
+ */
+import java.text.spi.DateFormatProvider;
+import java.util.spi.LocaleNameProvider;
+import java.util.spi.LocaleServiceProvider;
+import java.util.spi.TimeZoneNameProvider;
+
+import sun.util.LocaleServiceProviderPool;
+
+public class Bug6989440 {
+    public static void main(String[] args) {
+        TestThread t1 = new TestThread(LocaleNameProvider.class);
+        TestThread t2 = new TestThread(TimeZoneNameProvider.class);
+        TestThread t3 = new TestThread(DateFormatProvider.class);
+
+        t1.start();
+        t2.start();
+        t3.start();
+    }
+
+    static class TestThread extends Thread {
+        private Class<? extends LocaleServiceProvider> cls;
+
+        public TestThread(Class<? extends LocaleServiceProvider> providerClass) {
+            cls = providerClass;
+        }
+
+        public void run() {
+            LocaleServiceProviderPool pool = LocaleServiceProviderPool.getPool(cls);
+            pool.getAvailableLocales();
+        }
+    }
+}
--- a/test/java/util/Locale/LocaleEnhanceTest.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/test/java/util/Locale/LocaleEnhanceTest.java	Thu Nov 04 15:38:39 2010 -0700
@@ -614,6 +614,55 @@
         assertEquals("hans DE", "Simplified Han", hansLocale.getDisplayScript(Locale.GERMANY));
     }
 
+    public void testGetDisplayName() {
+        final Locale[] testLocales = {
+                Locale.ROOT,
+                new Locale("en"),
+                new Locale("en", "US"),
+                new Locale("", "US"),
+                new Locale("no", "NO", "NY"),
+                new Locale("", "", "NY"),
+                Locale.forLanguageTag("zh-Hans"),
+                Locale.forLanguageTag("zh-Hant"),
+                Locale.forLanguageTag("zh-Hans-CN"),
+                Locale.forLanguageTag("und-Hans"),
+        };
+
+        final String[] displayNameEnglish = {
+                "",
+                "English",
+                "English (United States)",
+                "United States",
+                "Norwegian (Norway,Nynorsk)",
+                "Nynorsk",
+                "Chinese (Simplified Han)",
+                "Chinese (Traditional Han)",
+                "Chinese (Simplified Han,China)",
+                "Simplified Han",
+        };
+
+        final String[] displayNameSimplifiedChinese = {
+                "",
+                "\u82f1\u6587",
+                "\u82f1\u6587 (\u7f8e\u56fd)",
+                "\u7f8e\u56fd",
+                "\u632a\u5a01\u6587 (\u632a\u5a01,Nynorsk)",
+                "Nynorsk",
+                "\u4e2d\u6587 (\u7b80\u4f53\u4e2d\u6587)",
+                "\u4e2d\u6587 (\u7e41\u4f53\u4e2d\u6587)",
+                "\u4e2d\u6587 (\u7b80\u4f53\u4e2d\u6587,\u4e2d\u56fd)",
+                "\u7b80\u4f53\u4e2d\u6587",
+        };
+
+        for (int i = 0; i < testLocales.length; i++) {
+            Locale loc = testLocales[i];
+            assertEquals("English display name for " + loc.toLanguageTag(),
+                    displayNameEnglish[i], loc.getDisplayName(Locale.ENGLISH));
+            assertEquals("Simplified Chinese display name for " + loc.toLanguageTag(),
+                    displayNameSimplifiedChinese[i], loc.getDisplayName(Locale.CHINA));
+        }
+    }
+
     ///
     /// Builder tests
     ///
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/accessibility/6986385/bug6986385.java	Thu Nov 04 15:38:39 2010 -0700
@@ -0,0 +1,47 @@
+/*
+ * 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 6986385
+   @summary JLayer should implement accessible interface
+   @author Alexander Potochkin
+   @run main bug6986385
+*/
+
+import javax.swing.*;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+
+public class bug6986385 {
+
+    public static void main(String... args) throws Exception {
+        JLayer l = new JLayer();
+        AccessibleContext acc = l.getAccessibleContext();
+        if (acc == null) {
+            throw new RuntimeException("JLayer's AccessibleContext is null");
+        }
+        if (acc.getAccessibleRole() != AccessibleRole.PANEL) {
+            throw new RuntimeException("JLayer's AccessibleRole must be PANEL");
+        }
+    }
+}
--- a/test/javax/sound/midi/Gervill/AudioFloatConverter/ToFloatArray.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/test/javax/sound/midi/Gervill/AudioFloatConverter/ToFloatArray.java	Thu Nov 04 15:38:39 2010 -0700
@@ -47,7 +47,7 @@
         for (int big = 0; big < 2; big+=1)
         for (int bits = 32; bits <= 64; bits+=32) {
             AudioFormat frm = new AudioFormat(
-                    AudioFloatConverter.PCM_FLOAT,
+                    AudioFormat.Encoding.PCM_FLOAT,
                     44100, bits, 1, bits/8,
                     44100, big==1);
             byte[] buff = new byte[testarray.length * frm.getFrameSize()];
--- a/test/javax/sound/midi/Gervill/SoftAudioSynthesizer/DummySourceDataLine.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/test/javax/sound/midi/Gervill/SoftAudioSynthesizer/DummySourceDataLine.java	Thu Nov 04 15:38:39 2010 -0700
@@ -84,16 +84,16 @@
                         AudioSystem.NOT_SPECIFIED, bits, channels, channels
                                 * bits / 8, AudioSystem.NOT_SPECIFIED, true));
             }
-            formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT,
+            formats.add(new AudioFormat(Encoding.PCM_FLOAT,
                     AudioSystem.NOT_SPECIFIED, 32, channels, channels * 4,
                     AudioSystem.NOT_SPECIFIED, false));
-            formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT,
+            formats.add(new AudioFormat(Encoding.PCM_FLOAT,
                     AudioSystem.NOT_SPECIFIED, 32, channels, channels * 4,
                     AudioSystem.NOT_SPECIFIED, true));
-            formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT,
+            formats.add(new AudioFormat(Encoding.PCM_FLOAT,
                     AudioSystem.NOT_SPECIFIED, 64, channels, channels * 8,
                     AudioSystem.NOT_SPECIFIED, false));
-            formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT,
+            formats.add(new AudioFormat(Encoding.PCM_FLOAT,
                     AudioSystem.NOT_SPECIFIED, 64, channels, channels * 8,
                     AudioSystem.NOT_SPECIFIED, true));
         }
--- a/test/javax/sound/midi/Gervill/SoftSynthesizer/DummySourceDataLine.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/test/javax/sound/midi/Gervill/SoftSynthesizer/DummySourceDataLine.java	Thu Nov 04 15:38:39 2010 -0700
@@ -84,16 +84,16 @@
                         AudioSystem.NOT_SPECIFIED, bits, channels, channels
                                 * bits / 8, AudioSystem.NOT_SPECIFIED, true));
             }
-            formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT,
+            formats.add(new AudioFormat(Encoding.PCM_FLOAT,
                     AudioSystem.NOT_SPECIFIED, 32, channels, channels * 4,
                     AudioSystem.NOT_SPECIFIED, false));
-            formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT,
+            formats.add(new AudioFormat(Encoding.PCM_FLOAT,
                     AudioSystem.NOT_SPECIFIED, 32, channels, channels * 4,
                     AudioSystem.NOT_SPECIFIED, true));
-            formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT,
+            formats.add(new AudioFormat(Encoding.PCM_FLOAT,
                     AudioSystem.NOT_SPECIFIED, 64, channels, channels * 8,
                     AudioSystem.NOT_SPECIFIED, false));
-            formats.add(new AudioFormat(AudioFloatConverter.PCM_FLOAT,
+            formats.add(new AudioFormat(Encoding.PCM_FLOAT,
                     AudioSystem.NOT_SPECIFIED, 64, channels, channels * 8,
                     AudioSystem.NOT_SPECIFIED, true));
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/JFileChooser/6396844/TwentyThousandTest.java	Thu Nov 04 15:38:39 2010 -0700
@@ -0,0 +1,151 @@
+/*
+ * 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 6396844
+ * @summary Tests memory leak for 20000 files
+ * @author Sergey Malenkov
+ * @run main/othervm/timeout=1000 -mx256m TwentyThousandTest
+ */
+
+import javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.FileWriter;
+
+public class TwentyThousandTest implements ActionListener, Runnable {
+
+    private static final int FILES = 20000;
+    private static final int ATTEMPTS = 100;
+    private static final int INTERVAL = 100;
+
+    private static final boolean ALWAYS_NEW_INSTANCE = false;
+    private static final boolean UPDATE_UI_EACH_INTERVAL = true;
+    private static final boolean AUTO_CLOSE_DIALOG = true;
+
+    private static JFileChooser CHOOSER;
+
+    private static String tmpDir;
+
+    public static void main(String[] args) throws Exception {
+        tmpDir = System.getProperty("java.io.tmpdir");
+
+        if (tmpDir.length() == 0) { //'java.io.tmpdir' isn't guaranteed to be defined
+            tmpDir = System.getProperty("user.home");
+        }
+
+        System.out.println("Temp directory: " + tmpDir);
+
+        System.out.println("Creating " + FILES + " files");
+
+        for (int i = 0; i < FILES; i++) {
+            File file = getTempFile(i);
+
+            FileWriter writer = new FileWriter(file);
+            writer.write("File " + i);
+            writer.close();
+        }
+
+        for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
+            if (laf.getClassName().contains("Motif")) {
+                continue;
+            }
+
+            UIManager.setLookAndFeel(laf.getClassName());
+
+            System.out.println("Do " + ATTEMPTS + " attempts for " + laf.getClassName());
+
+            for ( int i = 0; i < ATTEMPTS; i++ ) {
+                System.out.print(i + " ");
+
+                doAttempt();
+            }
+
+            System.out.println();
+
+            CHOOSER = null;
+        }
+
+        System.out.println("Removing " + FILES + " files");
+
+        for (int i = 0; i < FILES; i++) {
+            getTempFile(i).delete();
+        }
+
+        System.out.println( "Test passed successfully" );
+    }
+
+    private static File getTempFile(int i) {
+        return new File(tmpDir, "temp" + i + ".txt");
+    }
+
+    private static void doAttempt() throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                if ( ALWAYS_NEW_INSTANCE || ( CHOOSER == null ) )
+                    CHOOSER = new JFileChooser(tmpDir);
+
+                if ( UPDATE_UI_EACH_INTERVAL )
+                    CHOOSER.updateUI();
+
+                if ( AUTO_CLOSE_DIALOG ) {
+                    Thread t = new Thread( new TwentyThousandTest( CHOOSER ) );
+                    t.start();
+                    CHOOSER.showOpenDialog( null );
+                } else {
+                    CHOOSER.showOpenDialog( null );
+                }
+            }
+        });
+
+        // Allow to collect garbage by GC
+        Thread.sleep(1000);
+
+        System.gc();
+    }
+
+    private final JFileChooser chooser;
+
+    TwentyThousandTest( JFileChooser chooser ) {
+        this.chooser = chooser;
+    }
+
+    public void run() {
+        while ( !this.chooser.isShowing() ) {
+            try {
+                Thread.sleep( 30 );
+            } catch ( InterruptedException exception ) {
+                exception.printStackTrace();
+            }
+        }
+        Timer timer = new Timer( INTERVAL, this );
+        timer.setRepeats( false );
+        timer.start();
+    }
+
+    public void actionPerformed( ActionEvent event ) {
+        this.chooser.cancelSelection();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/swing/plaf/basic/Test6984643.java	Thu Nov 04 15:38:39 2010 -0700
@@ -0,0 +1,64 @@
+/*
+ * 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 6984643
+ * @summary Unable to instantiate JFileChooser with a minimal BasicL&F descendant installed
+ * @author Pavel Porvatov
+ */
+
+import javax.swing.*;
+import javax.swing.plaf.basic.BasicLookAndFeel;
+
+public class Test6984643 {
+    public static void main(String[] args) throws Exception {
+        UIManager.setLookAndFeel(new BasicLookAndFeel() {
+            public String getName() {
+                return "A name";
+            }
+
+            public String getID() {
+                return "An id";
+            }
+
+            public String getDescription() {
+                return "A description";
+            }
+
+            public boolean isNativeLookAndFeel() {
+                return false;
+            }
+
+            public boolean isSupportedLookAndFeel() {
+                return true;
+            }
+        });
+
+        SwingUtilities.invokeLater(new Runnable() {
+            public void run() {
+                new JFileChooser();
+            }
+        });
+    }
+}
--- a/test/javax/swing/system/6799345/TestShutdown.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/test/javax/swing/system/6799345/TestShutdown.java	Thu Nov 04 15:38:39 2010 -0700
@@ -59,7 +59,7 @@
 
         while (!appcontextInitDone)
         {
-            Thread.sleep(500);
+            Thread.sleep(1000);
         }
 
         targetAppContext.dispose();
@@ -146,7 +146,6 @@
                     startGUI();
                 }
             });
-            stk.realSync();
 
             // start multiple SwingWorkers
             while (!Thread.interrupted())
--- a/test/sun/java2d/SunGraphics2D/DrawImageBilinear.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/test/sun/java2d/SunGraphics2D/DrawImageBilinear.java	Thu Nov 04 15:38:39 2010 -0700
@@ -104,7 +104,9 @@
 
             // second time will be a texture->surface blit
             g2d.drawImage(bimg2, 80, 10, 40, 40, null);
-            g2d.drawImage(bimg2, 80, 10, 40, 40, null);
+            if (!skipOglTextureTest) {
+                g2d.drawImage(bimg2, 80, 10, 40, 40, null);
+            }
 
             // third time will be a pbuffer->surface blit
             if (vimg.validate(getGraphicsConfiguration()) != VolatileImage.IMAGE_OK) {
@@ -150,6 +152,8 @@
         }
     }
 
+    private static boolean skipOglTextureTest = false;
+
     public static void main(String[] args) {
         boolean show = false;
         for (String arg : args) {
@@ -158,6 +162,11 @@
             }
         }
 
+        String arch = System.getProperty("os.arch");
+        boolean isOglEnabled = Boolean.getBoolean("sun.java2d.opengl");
+        skipOglTextureTest = isOglEnabled && ("sparc".equals(arch));
+        System.out.println("Skip OpenGL texture test: " + skipOglTextureTest);
+
         DrawImageBilinear test = new DrawImageBilinear();
         Frame frame = new Frame();
         frame.add(test);
--- a/test/sun/java2d/pipe/MutableColorTest/MutableColorTest.java	Tue Nov 02 15:04:13 2010 +0000
+++ b/test/sun/java2d/pipe/MutableColorTest/MutableColorTest.java	Thu Nov 04 15:38:39 2010 -0700
@@ -105,7 +105,7 @@
         for (int y = 0; y < snapshot.getHeight(); y++) {
             for (int x = 0; x < snapshot.getWidth(); x++) {
                 int snapRGB = snapshot.getRGB(x, y);
-                if (snapRGB != evilColor) {
+                if (!isSameColor(snapRGB, evilColor)) {
                     System.err.printf("Wrong RGB for %s at (%d,%d): 0x%x " +
                         "instead of 0x%x\n", desc, x, y, snapRGB, evilColor);
                     String fileName = "MutableColorTest_"+desc+".png";
@@ -166,4 +166,24 @@
 
         System.err.println("Test passed.");
     }
+
+    /*
+     * We assume that colors with slightly different components
+     * are the same. This is done just in order to workaround
+     * peculiarities of OGL rendering pipeline on some platforms.
+     * See CR 6989217 for more details.
+     */
+     private static boolean isSameColor(int color1, int color2) {
+        final int tolerance = 2;
+
+        for (int i = 0; i < 32; i += 8) {
+            int c1 = 0xff & (color1 >> i);
+            int c2 = 0xff & (color2 >> i);
+
+            if (Math.abs(c1 - c2) > tolerance) {
+                return false;
+            }
+        }
+        return true;
+    }
 }