From a8072dc2a061d150bd804a0089d61f81ab23608d Mon Sep 17 00:00:00 2001 From: Phil Race Date: Wed, 13 Jun 2012 12:46:02 -0700 Subject: [PATCH 1/4] 7027300: Unsynchronized HashMap access causes endless loop Reviewed-by: bae, jgodinez --- jdk/src/share/classes/sun/font/SunLayoutEngine.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/jdk/src/share/classes/sun/font/SunLayoutEngine.java b/jdk/src/share/classes/sun/font/SunLayoutEngine.java index 9e6df01bd40..efeebca9180 100644 --- a/jdk/src/share/classes/sun/font/SunLayoutEngine.java +++ b/jdk/src/share/classes/sun/font/SunLayoutEngine.java @@ -33,7 +33,7 @@ package sun.font; 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 @@ public final class SunLayoutEngine implements LayoutEngine, LayoutEngineFactory // !!! 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); } From 9d94d3259409493bf862c032243294652b86921f Mon Sep 17 00:00:00 2001 From: Andrew Brygin Date: Thu, 14 Jun 2012 11:14:44 +0400 Subject: [PATCH 2/4] 7153693: Three 2D_ImageIO tests failed due ImageFormatException on OEL 6.* Unbreakable Kernel x64 Reviewed-by: jgodinez, prr --- jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c b/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c index 1879c35ced3..33ff3efe653 100644 --- a/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c +++ b/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c @@ -337,7 +337,7 @@ sun_jpeg_fill_suspended_buffer(j_decompress_ptr cinfo) /* 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; From 0527d0162252850f461e1f648ae4aa3e4f170b24 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Thu, 14 Jun 2012 16:34:43 -0700 Subject: [PATCH 3/4] 7158366: [macosx] Print-to-file dialog doesn't have an entry field for a name Reviewed-by: bae, jgodinez --- jdk/src/share/classes/sun/print/ServiceDialog.java | 1 + 1 file changed, 1 insertion(+) diff --git a/jdk/src/share/classes/sun/print/ServiceDialog.java b/jdk/src/share/classes/sun/print/ServiceDialog.java index 136b40e487b..1251cf9beba 100644 --- a/jdk/src/share/classes/sun/print/ServiceDialog.java +++ b/jdk/src/share/classes/sun/print/ServiceDialog.java @@ -429,6 +429,7 @@ public class ServiceDialog extends JDialog implements ActionListener { 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); From cc6e343055fc73a41ee8b81b17f229449e679304 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Tue, 19 Jun 2012 09:07:31 -0700 Subject: [PATCH 4/4] 7124536: [macosx] PrintServiceLookup.lookupDefaultPrintService() return null Reviewed-by: bae, igor --- .../solaris/classes/sun/print/CUPSPrinter.java | 16 ++++++++++++++-- .../sun/print/UnixPrintServiceLookup.java | 12 ++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/jdk/src/solaris/classes/sun/print/CUPSPrinter.java b/jdk/src/solaris/classes/sun/print/CUPSPrinter.java index c64ea8b1122..34a131317ac 100644 --- a/jdk/src/solaris/classes/sun/print/CUPSPrinter.java +++ b/jdk/src/solaris/classes/sun/print/CUPSPrinter.java @@ -278,14 +278,26 @@ public class CUPSPrinter { 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) diff --git a/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java b/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java index 7f402865d2b..086a482e729 100644 --- a/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java +++ b/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java @@ -114,6 +114,10 @@ public class UnixPrintServiceLookup extends PrintServiceLookup 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 @@ public class UnixPrintServiceLookup extends PrintServiceLookup } } } else { - if (isSysV()) { + if (isMac() || isSysV()) { printers = getAllPrinterNamesSysV(); } else { //BSD printers = getAllPrinterNamesBSD(); @@ -361,7 +365,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup 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 @@ public class UnixPrintServiceLookup extends PrintServiceLookup if (CUPSPrinter.isCupsRunning()) { defaultPrinter = CUPSPrinter.getDefaultPrinter(); } else { - if (isSysV()) { + if (isMac() || isSysV()) { defaultPrinter = getDefaultPrinterNameSysV(); } else { defaultPrinter = getDefaultPrinterNameBSD(); @@ -644,7 +648,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup return names; } - private String getDefaultPrinterNameSysV() { + static String getDefaultPrinterNameSysV() { String defaultPrinter = "lp"; String command = "/usr/bin/lpstat -d";