Merge
authorlana
Mon, 25 Jun 2012 21:34:27 -0700
changeset 12998 5db2c4bdf3f2
parent 12992 b6980327bf28 (current diff)
parent 12997 7ad469d89bed (diff)
child 13010 20759a13274c
Merge
--- a/jdk/src/share/classes/sun/font/SunLayoutEngine.java	Thu Jun 21 17:08:14 2012 -0700
+++ b/jdk/src/share/classes/sun/font/SunLayoutEngine.java	Mon Jun 25 21:34:27 2012 -0700
@@ -33,7 +33,7 @@
 import sun.font.GlyphLayout.*;
 import java.awt.geom.Point2D;
 import java.lang.ref.SoftReference;
-import java.util.HashMap;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.Locale;
 
 /*
@@ -129,9 +129,9 @@
 
   // !!! don't need this unless we have more than one sun layout engine...
     public LayoutEngine getEngine(LayoutEngineKey key) {
-        HashMap cache = (HashMap)cacheref.get();
+        ConcurrentHashMap cache = (ConcurrentHashMap)cacheref.get();
         if (cache == null) {
-            cache = new HashMap();
+            cache = new ConcurrentHashMap();
             cacheref = new SoftReference(cache);
         }
 
--- a/jdk/src/share/classes/sun/print/ServiceDialog.java	Thu Jun 21 17:08:14 2012 -0700
+++ b/jdk/src/share/classes/sun/print/ServiceDialog.java	Mon Jun 25 21:34:27 2012 -0700
@@ -429,6 +429,7 @@
         ValidatingFileChooser jfc = new ValidatingFileChooser();
         jfc.setApproveButtonText(getMsg("button.ok"));
         jfc.setDialogTitle(getMsg("dialog.printtofile"));
+        jfc.setDialogType(JFileChooser.SAVE_DIALOG);
         jfc.setSelectedFile(fileDest);
 
         int returnVal = jfc.showDialog(this, null);
--- a/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c	Thu Jun 21 17:08:14 2012 -0700
+++ b/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c	Mon Jun 25 21:34:27 2012 -0700
@@ -337,7 +337,7 @@
     /* Save the data currently in the buffer */
     offset = src->pub.bytes_in_buffer;
     if (src->pub.next_input_byte > src->inbuf) {
-        memcpy(src->inbuf, src->pub.next_input_byte, offset);
+        memmove(src->inbuf, src->pub.next_input_byte, offset);
     }
     RELEASE_ARRAYS(env, src);
     buflen = (*env)->GetArrayLength(env, src->hInputBuffer) - offset;
--- a/jdk/src/solaris/classes/sun/print/CUPSPrinter.java	Thu Jun 21 17:08:14 2012 -0700
+++ b/jdk/src/solaris/classes/sun/print/CUPSPrinter.java	Mon Jun 25 21:34:27 2012 -0700
@@ -278,14 +278,26 @@
                                          is);
                     is.close();
 
-                    if (responseMap.length > 0) {
+                    if (responseMap != null && responseMap.length > 0) {
                         defaultMap = responseMap[0];
                     }
 
                     if (defaultMap == null) {
                         os.close();
                         urlConnection.disconnect();
-                        return null;
+
+                        /* CUPS on OS X, as initially configured, considers the
+                         * default printer to be the last one used that's
+                         * presently available. So if no default was
+                         * reported, exec lpstat -d which has all the Apple
+                         * special behaviour for this built in.
+                         */
+                         if (UnixPrintServiceLookup.isMac()) {
+                             return UnixPrintServiceLookup.
+                                                   getDefaultPrinterNameSysV();
+                         } else {
+                             return null;
+                         }
                     }
 
                     AttributeClass attribClass = (AttributeClass)
--- a/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java	Thu Jun 21 17:08:14 2012 -0700
+++ b/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java	Mon Jun 25 21:34:27 2012 -0700
@@ -114,6 +114,10 @@
             new sun.security.action.GetPropertyAction("os.name"));
     }
 
+    static boolean isMac() {
+        return osname.startsWith("Mac");
+    }
+
     static boolean isSysV() {
         return osname.equals("SunOS");
     }
@@ -212,7 +216,7 @@
                 }
             }
         } else {
-            if (isSysV()) {
+            if (isMac() || isSysV()) {
                 printers = getAllPrinterNamesSysV();
             } else { //BSD
                 printers = getAllPrinterNamesBSD();
@@ -361,7 +365,7 @@
         if (name == null || name.equals("") || !checkPrinterName(name)) {
             return null;
         }
-        if (isSysV()) {
+        if (isMac() || isSysV()) {
             printer = getNamedPrinterNameSysV(name);
         } else {
             printer = getNamedPrinterNameBSD(name);
@@ -523,7 +527,7 @@
         if (CUPSPrinter.isCupsRunning()) {
             defaultPrinter = CUPSPrinter.getDefaultPrinter();
         } else {
-            if (isSysV()) {
+            if (isMac() || isSysV()) {
                 defaultPrinter = getDefaultPrinterNameSysV();
             } else {
                 defaultPrinter = getDefaultPrinterNameBSD();
@@ -644,7 +648,7 @@
         return names;
     }
 
-    private String getDefaultPrinterNameSysV() {
+    static String getDefaultPrinterNameSysV() {
         String defaultPrinter = "lp";
         String command = "/usr/bin/lpstat -d";