From bce847b2be908d3183c0c8c22d14fb22b3b94323 Mon Sep 17 00:00:00 2001 From: Jennifer Godinez Date: Thu, 15 Aug 2013 11:56:33 -0700 Subject: [PATCH 1/4] 8023045: [MacOSX] PrinterIOException when printing a JComponent Reviewed-by: bae, jchen --- .../share/classes/sun/print/PSPrinterJob.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/jdk/src/share/classes/sun/print/PSPrinterJob.java b/jdk/src/share/classes/sun/print/PSPrinterJob.java index c4bcc23aa02..30777b3cefe 100644 --- a/jdk/src/share/classes/sun/print/PSPrinterJob.java +++ b/jdk/src/share/classes/sun/print/PSPrinterJob.java @@ -339,6 +339,8 @@ public class PSPrinterJob extends RasterPrinterJob { */ private static Properties mFontProps = null; + private static boolean isMac; + /* Class static initialiser block */ static { //enable priviledges so initProps can access system properties, @@ -347,6 +349,8 @@ public class PSPrinterJob extends RasterPrinterJob { new java.security.PrivilegedAction() { public Object run() { mFontProps = initProps(); + String osName = System.getProperty("os.name"); + isMac = osName.startsWith("Mac"); return null; } }); @@ -473,6 +477,12 @@ public class PSPrinterJob extends RasterPrinterJob { PrintService pServ = getPrintService(); if (pServ != null) { mDestination = pServ.getName(); + if (isMac) { + PrintServiceAttributeSet psaSet = pServ.getAttributes() ; + if (psaSet != null) { + mDestination = psaSet.get(PrinterName.class).toString(); + } + } } } } @@ -771,6 +781,12 @@ public class PSPrinterJob extends RasterPrinterJob { PrintService pServ = getPrintService(); if (pServ != null) { mDestination = pServ.getName(); + if (isMac) { + PrintServiceAttributeSet psaSet = pServ.getAttributes(); + if (psaSet != null) { + mDestination = psaSet.get(PrinterName.class).toString() ; + } + } } PrinterSpooler spooler = new PrinterSpooler(); java.security.AccessController.doPrivileged(spooler); From f09520a064614fa8fd83ad9735d9a5c8ff6c5a12 Mon Sep 17 00:00:00 2001 From: Vadim Pakhnushev Date: Fri, 16 Aug 2013 15:57:28 +0400 Subject: [PATCH 2/4] 8013446: [parfait] Memory leak in jdk/src/windows/native/sun/java2d/opengl/WGLSurfaceData.c Reviewed-by: bae, prr --- .../windows/native/sun/java2d/opengl/WGLSurfaceData.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/jdk/src/windows/native/sun/java2d/opengl/WGLSurfaceData.c b/jdk/src/windows/native/sun/java2d/opengl/WGLSurfaceData.c index ee553224b25..ffcb95b0af5 100644 --- a/jdk/src/windows/native/sun/java2d/opengl/WGLSurfaceData.c +++ b/jdk/src/windows/native/sun/java2d/opengl/WGLSurfaceData.c @@ -67,14 +67,15 @@ Java_sun_java2d_opengl_WGLSurfaceData_initOps(JNIEnv *env, jobject wglsd, J2dTraceLn(J2D_TRACE_INFO, "WGLSurfaceData_initOps"); - if (oglsdo == NULL) { - JNU_ThrowOutOfMemoryError(env, "Initialization of SurfaceData failed."); - return; - } if (wglsdo == NULL) { JNU_ThrowOutOfMemoryError(env, "creating native wgl ops"); return; } + if (oglsdo == NULL) { + free(wglsdo); + JNU_ThrowOutOfMemoryError(env, "Initialization of SurfaceData failed."); + return; + } oglsdo->privOps = wglsdo; From 1dd31aff635cafece8b4c7686b4eeb5abb1f1b57 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Mon, 19 Aug 2013 03:58:47 -0700 Subject: [PATCH 3/4] 8017580: Crash in font loading code on Linux (due to use of reflection) Reviewed-by: bae, vadim --- jdk/src/share/native/sun/font/sunFont.c | 25 +++++++++++++++++----- jdk/src/share/native/sun/font/sunfontids.h | 2 +- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/jdk/src/share/native/sun/font/sunFont.c b/jdk/src/share/native/sun/font/sunFont.c index 95927b003d7..70bfee8a102 100644 --- a/jdk/src/share/native/sun/font/sunFont.c +++ b/jdk/src/share/native/sun/font/sunFont.c @@ -71,13 +71,17 @@ JNIEXPORT jlong JNICALL Java_sun_font_NullFontScaler_getGlyphImage void initLCDGammaTables(); /* placeholder for extern variable */ +static int initialisedFontIDs = 0; FontManagerNativeIDs sunFontIDs; -JNIEXPORT void JNICALL -Java_sun_font_SunFontManager_initIDs - (JNIEnv *env, jclass cls) { +static void initFontIDs(JNIEnv *env) { - jclass tmpClass = (*env)->FindClass(env, "sun/font/TrueTypeFont"); + jclass tmpClass; + + if (initialisedFontIDs) { + return; + } + tmpClass = (*env)->FindClass(env, "sun/font/TrueTypeFont"); sunFontIDs.ttReadBlockMID = (*env)->GetMethodID(env, tmpClass, "readBlock", "(Ljava/nio/ByteBuffer;II)I"); @@ -173,9 +177,20 @@ Java_sun_font_SunFontManager_initIDs (*env)->GetFieldID(env, tmpClass, "lcdSubPixPos", "Z"); initLCDGammaTables(); + + initialisedFontIDs = 1; } -JNIEXPORT FontManagerNativeIDs getSunFontIDs() { +JNIEXPORT void JNICALL +Java_sun_font_SunFontManager_initIDs + (JNIEnv *env, jclass cls) { + + initFontIDs(env); +} + +JNIEXPORT FontManagerNativeIDs getSunFontIDs(JNIEnv *env) { + + initFontIDs(env); return sunFontIDs; } diff --git a/jdk/src/share/native/sun/font/sunfontids.h b/jdk/src/share/native/sun/font/sunfontids.h index 211ab7a4c72..a7e4290ad40 100644 --- a/jdk/src/share/native/sun/font/sunfontids.h +++ b/jdk/src/share/native/sun/font/sunfontids.h @@ -84,7 +84,7 @@ typedef struct FontManagerNativeIDs { /* Note: we share variable in the context of fontmanager lib but we need access method to use it from separate rasterizer lib */ extern FontManagerNativeIDs sunFontIDs; -JNIEXPORT FontManagerNativeIDs getSunFontIDs(); +JNIEXPORT FontManagerNativeIDs getSunFontIDs(JNIEnv* env); #ifdef __cplusplus } From c2aba135c237eea1e05859802322aa6cb9e565a9 Mon Sep 17 00:00:00 2001 From: Jennifer Godinez Date: Mon, 19 Aug 2013 11:21:19 -0700 Subject: [PATCH 4/4] 8022241: [macosx] [PIT] lookupPrintServices() returns one too long array Reviewed-by: prr, jchen --- .../sun/print/UnixPrintServiceLookup.java | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java b/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java index 2c2a6406293..54dc8b666fc 100644 --- a/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java +++ b/jdk/src/solaris/classes/sun/print/UnixPrintServiceLookup.java @@ -245,7 +245,7 @@ public class UnixPrintServiceLookup extends PrintServiceLookup continue; } if ((defaultPrintService != null) - && printers[p].equals(defaultPrintService.getName())) { + && printers[p].equals(getPrinterDestName(defaultPrintService))) { printerList.add(defaultPrintService); defaultIndex = printerList.size() - 1; } else { @@ -270,11 +270,12 @@ public class UnixPrintServiceLookup extends PrintServiceLookup } else { int j; for (j=0; j