changeset 7328:e3d5df92f4ff

Merge
author lana
date Wed, 19 Jun 2013 17:57:12 -0700
parents 42aa9f182885 c636942a28ef
children a117785457f6
files
diffstat 15 files changed, 382 insertions(+), 51 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/awt/color/ICC_Profile.java	Tue Jun 18 15:32:53 2013 -0700
+++ b/src/share/classes/java/awt/color/ICC_Profile.java	Wed Jun 19 17:57:12 2013 -0700
@@ -37,6 +37,7 @@
 
 import sun.java2d.cmm.PCMM;
 import sun.java2d.cmm.CMSManager;
+import sun.java2d.cmm.ProfileDataVerifier;
 import sun.java2d.cmm.ProfileDeferralMgr;
 import sun.java2d.cmm.ProfileDeferralInfo;
 import sun.java2d.cmm.ProfileActivator;
@@ -775,6 +776,8 @@
             ProfileDeferralMgr.activateProfiles();
         }
 
+        ProfileDataVerifier.verify(data);
+
         try {
             theID = CMSManager.getModule().loadProfile(data);
         } catch (CMMException c) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/sun/java2d/cmm/ProfileDataVerifier.java	Wed Jun 19 17:57:12 2013 -0700
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+package sun.java2d.cmm;
+
+public class ProfileDataVerifier {
+    /**
+     * Throws an IllegalArgumentException if the data does not correspond
+     * to a valid ICC Profile.
+     *
+     * @param data the specified profile data.
+     */
+    public static void verify(byte[] data) {
+        if (data == null) {
+            throw new IllegalArgumentException("Invalid ICC Profile Data");
+        }
+
+        if (data.length < TOC_OFFSET) {
+            // not enough data for profile header
+            throw new IllegalArgumentException("Invalid ICC Profile Data");
+        }
+
+        // check profile size
+        final int size = readInt32(data, 0);
+        final int tagCount = readInt32(data, HEADER_SIZE);
+
+        if (tagCount < 0 || tagCount > MAX_TAG_COUNT) {
+            throw new IllegalArgumentException("Invalid ICC Profile Data");
+        }
+
+        if (size < (TOC_OFFSET + (tagCount * TOC_RECORD_SIZE)) ||
+            size > data.length)
+        {
+            throw new IllegalArgumentException("Invalid ICC Profile Data");
+        }
+
+        final int sig = readInt32(data, 36);
+
+        if (PROFILE_FILE_SIGNATURE != sig) {
+            throw new IllegalArgumentException("Invalid ICC Profile Data");
+        }
+
+        // verify table of content
+        for (int i = 0; i < tagCount; i++) {
+            final int tag_offset = getTagOffset(i, data);
+            final int tag_size = getTagSize(i, data);
+
+            if (tag_offset < TOC_OFFSET || tag_offset > size) {
+                throw new IllegalArgumentException("Invalid ICC Profile Data");
+            }
+
+            if (tag_size < 0 ||
+                tag_size > (Integer.MAX_VALUE - tag_offset) ||
+                tag_size + tag_offset > size)
+            {
+                throw new IllegalArgumentException("Invalid ICC Profile Data");
+            }
+        }
+    }
+
+    private static int getTagOffset(int idx, byte[] data) {
+        final int pos = TOC_OFFSET + idx * TOC_RECORD_SIZE + 4;
+        return readInt32(data, pos);
+    }
+
+    private static int getTagSize(int idx, byte[] data) {
+        final int pos = TOC_OFFSET + idx * TOC_RECORD_SIZE + 8;
+        return readInt32(data, pos);
+    }
+
+    private static int readInt32(byte[] data, int off) {
+        int res = 0;
+        for (int i = 0; i < 4; i++) {
+            res = res << 8;
+
+            res |= (0xff & data[off++]);
+        }
+        return res;
+    }
+
+    /**
+     * Lcms limit for the number of tags: 100
+     * Kcms limit for the number of tags: N/A
+     */
+    private static final int MAX_TAG_COUNT = 100;
+
+    private static final int HEADER_SIZE = 128;
+    private static final int TOC_OFFSET = HEADER_SIZE + 4;
+    private static final int TOC_RECORD_SIZE = 12;
+
+    private static final int PROFILE_FILE_SIGNATURE = 0x61637370;
+}
--- a/src/share/native/sun/font/layout/KernTable.cpp	Tue Jun 18 15:32:53 2013 -0700
+++ b/src/share/native/sun/font/layout/KernTable.cpp	Wed Jun 19 17:57:12 2013 -0700
@@ -96,7 +96,7 @@
  * TODO: respect header flags
  */
 KernTable::KernTable(const LETableReference& base, LEErrorCode &success)
-  : pairs(), pairsSwapped(NULL), fTable(base)
+  : pairsSwapped(NULL), fTable(base)
 {
   if(LE_FAILURE(success) || (fTable.isEmpty())) {
 #if DEBUG
@@ -143,32 +143,36 @@
 #endif
 
         if(LE_SUCCESS(success) && nPairs>0) {
-          // pairs is an instance member, and table is on the stack.
-          // set 'pairs' based on table.getAlias(). This will range check it.
+          // pairsSwapped is an instance member, and table is on the stack.
+          // set 'pairsSwapped' based on table.getAlias(). This will range check it.
 
-          pairs = LEReferenceToArrayOf<PairInfo>(fTable, // based on overall table
-                                                 success,
-                                                 (const PairInfo*)table.getAlias(),  // subtable 0 + ..
-                                                 KERN_SUBTABLE_0_HEADER_SIZE,  // .. offset of header size
-                                                 nPairs); // count
-        }
-        if (LE_SUCCESS(success) && pairs.isValid()) {
-            pairsSwapped =  (PairInfo*)(malloc(nPairs*sizeof(PairInfo)));
-            PairInfo *p = (PairInfo*)pairsSwapped;
-            for (int i = 0; LE_SUCCESS(success) && i < nPairs; i++, p++) {
-              memcpy(p, pairs.getAlias(i,success), KERN_PAIRINFO_SIZE);
-              p->key = SWAPL(p->key);
+          pairsSwapped = (PairInfo*)(fTable.getFont()->getKernPairs());
+          if (pairsSwapped == NULL) {
+            LEReferenceToArrayOf<PairInfo>pairs =
+              LEReferenceToArrayOf<PairInfo>(fTable, // based on overall table
+                                             success,
+                                             (const PairInfo*)table.getAlias(),  // subtable 0 + ..
+                                             KERN_SUBTABLE_0_HEADER_SIZE,  // .. offset of header size
+                                             nPairs); // count
+            if (LE_SUCCESS(success) && pairs.isValid()) {
+              pairsSwapped =  (PairInfo*)(malloc(nPairs*sizeof(PairInfo)));
+              PairInfo *p = (PairInfo*)pairsSwapped;
+              for (int i = 0; LE_SUCCESS(success) && i < nPairs; i++, p++) {
+                memcpy(p, pairs.getAlias(i,success), KERN_PAIRINFO_SIZE);
+                p->key = SWAPL(p->key);
+              }
+              fTable.getFont()->setKernPairs((void*)pairsSwapped); // store it
             }
-            fTable.getFont()->setKernPairs((void*)pairsSwapped); // store it
+          }
         }
 
 #if 0
-        fprintf(stderr, "coverage: %0.4x nPairs: %d pairs %p\n", coverage, nPairs, pairs.getAlias());
+        fprintf(stderr, "coverage: %0.4x nPairs: %d pairs %p\n", coverage, nPairs, pairsSwapped);
         fprintf(stderr, "  searchRange: %d entrySelector: %d rangeShift: %d\n", searchRange, entrySelector, rangeShift);
         fprintf(stderr, "[[ ignored font table entries: range %d selector %d shift %d ]]\n", SWAPW(table->searchRange), SWAPW(table->entrySelector), SWAPW(table->rangeShift));
 #endif
 #if DEBUG
-        fprintf(stderr, "coverage: %0.4x nPairs: %d pairs 0x%x\n", coverage, nPairs, pairs);
+        fprintf(stderr, "coverage: %0.4x nPairs: %d pairs 0x%x\n", coverage, nPairs, pairsSwapped);
         fprintf(stderr,
           "  searchRange(pairs): %d entrySelector: %d rangeShift(pairs): %d\n",
           searchRange, entrySelector, rangeShift);
@@ -182,7 +186,7 @@
               ids[id] = (char)i;
             }
           }
-          PairInfo *p = pairs;
+          PairInfo *p = pairsSwapped;
           for (int i = 0; i < nPairs; ++i, p++) {
             le_uint32 k = p->key;
             le_uint16 left = (k >> 16) & 0xffff;
--- a/src/share/native/sun/font/layout/KernTable.h	Tue Jun 18 15:32:53 2013 -0700
+++ b/src/share/native/sun/font/layout/KernTable.h	Wed Jun 19 17:57:12 2013 -0700
@@ -57,7 +57,6 @@
  private:
   le_uint16 coverage;
   le_uint16 nPairs;
-  LEReferenceToArrayOf<PairInfo> pairs;
   PairInfo  *pairsSwapped;
   const LETableReference &fTable;
   le_uint16 searchRange;
--- a/src/share/native/sun/font/layout/LayoutEngine.cpp	Tue Jun 18 15:32:53 2013 -0700
+++ b/src/share/native/sun/font/layout/LayoutEngine.cpp	Wed Jun 19 17:57:12 2013 -0700
@@ -569,7 +569,6 @@
 {
   if(fGlyphStorage!=NULL) {
     fGlyphStorage->reset();
-    fGlyphStorage = NULL;
   }
 }
 
--- a/src/solaris/classes/sun/print/UnixPrintServiceLookup.java	Tue Jun 18 15:32:53 2013 -0700
+++ b/src/solaris/classes/sun/print/UnixPrintServiceLookup.java	Wed Jun 19 17:57:12 2013 -0700
@@ -362,10 +362,33 @@
      */
     private PrintService getServiceByName(PrinterName nameAttr) {
         String name = nameAttr.getValue();
-        PrintService printer = null;
         if (name == null || name.equals("") || !checkPrinterName(name)) {
             return null;
         }
+        /* check is all printers are already available */
+        if (printServices != null) {
+            for (PrintService printService : printServices) {
+                if (printService.getName().equals(name)) {
+                    return printService;
+                }
+            }
+        }
+        /* take CUPS into account first */
+        if (CUPSPrinter.isCupsRunning()) {
+            try {
+                return new IPPPrintService(name,
+                                           new URL("http://"+
+                                                   CUPSPrinter.getServer()+":"+
+                                                   CUPSPrinter.getPort()+"/"+
+                                                   name));
+            } catch (Exception e) {
+                IPPPrintService.debug_println(debugPrefix+
+                                              " getServiceByName Exception "+
+                                              e);
+            }
+        }
+        /* fallback if nothing not having a printer at this point */
+        PrintService printer = null;
         if (isMac() || isSysV()) {
             printer = getNamedPrinterNameSysV(name);
         } else {
--- a/src/windows/classes/sun/awt/windows/WPrinterJob.java	Tue Jun 18 15:32:53 2013 -0700
+++ b/src/windows/classes/sun/awt/windows/WPrinterJob.java	Wed Jun 19 17:57:12 2013 -0700
@@ -1269,11 +1269,13 @@
         mLastFontFamily = null;
     }
 
+    private boolean defaultCopies = true;
     /**
      * Set the number of copies to be printed.
      */
     public void setCopies(int copies) {
         super.setCopies(copies);
+        defaultCopies = false;
         mAttCopies = copies;
         setNativeCopies(copies);
     }
@@ -1529,8 +1531,9 @@
     }
 
     /* SheetCollate */
-    private final boolean getCollateAttrib() {
-        return (mAttCollate == 1);
+    private final int getCollateAttrib() {
+        // -1 means unset, 0 uncollated, 1 collated.
+        return mAttCollate;
     }
 
     private void setCollateAttrib(Attribute attr) {
@@ -1553,6 +1556,10 @@
         int orient = PageFormat.PORTRAIT;
         OrientationRequested orientReq = (attributes == null) ? null :
             (OrientationRequested)attributes.get(OrientationRequested.class);
+        if (orientReq == null) {
+            orientReq = (OrientationRequested)
+               myService.getDefaultAttributeValue(OrientationRequested.class);
+        }
         if (orientReq != null) {
             if (orientReq == OrientationRequested.REVERSE_LANDSCAPE) {
                 orient = PageFormat.REVERSE_LANDSCAPE;
@@ -1573,7 +1580,11 @@
 
     /* Copies and Page Range. */
     private final int getCopiesAttrib() {
-        return getCopiesInt();
+        if (defaultCopies) {
+            return 0;
+        } else {
+            return getCopiesInt();
+        }
      }
 
     private final void setRangeCopiesAttribute(int from, int to,
@@ -1584,6 +1595,7 @@
                 attributes.add(new PageRanges(from, to));
                 setPageRange(from, to);
             }
+            defaultCopies = false;
             attributes.add(new Copies(copies));
             /* Since this is called from native to tell Java to sync
              * up with native, we don't call this class's own setCopies()
--- a/src/windows/classes/sun/print/Win32PrintService.java	Tue Jun 18 15:32:53 2013 -0700
+++ b/src/windows/classes/sun/print/Win32PrintService.java	Wed Jun 19 17:57:12 2013 -0700
@@ -180,6 +180,9 @@
     private static final int DMDUP_VERTICAL = 2;
     private static final int DMDUP_HORIZONTAL = 3;
     private static final int DMCOLLATE_TRUE = 1;
+    private static final int DMCOLOR_MONOCHROME = 1;
+    private static final int DMCOLOR_COLOR = 2;
+
 
     // media sizes with indices above dmPaperToPrintService' length
     private static final int DMPAPER_A2 = 66;
@@ -1041,6 +1044,7 @@
         int defOrient = defaults[5];
         int defSides = defaults[6];
         int defCollate = defaults[7];
+        int defColor = defaults[8];
 
         if (category == Copies.class) {
             if (defCopies > 0) {
@@ -1049,11 +1053,10 @@
                 return new Copies(1);
             }
         } else if (category == Chromaticity.class) {
-            int caps = getPrinterCapabilities();
-            if ((caps & DEVCAP_COLOR) == 0) {
+            if (defColor == DMCOLOR_COLOR) {
+                return Chromaticity.COLOR;
+            } else {
                 return Chromaticity.MONOCHROME;
-            } else {
-                return Chromaticity.COLOR;
             }
         } else if (category == JobName.class) {
             return new JobName("Java Printing", null);
--- a/src/windows/native/sun/windows/WPrinterJob.cpp	Tue Jun 18 15:32:53 2013 -0700
+++ b/src/windows/native/sun/windows/WPrinterJob.cpp	Wed Jun 19 17:57:12 2013 -0700
@@ -750,7 +750,7 @@
 
 
 #define GETDEFAULT_ERROR        -50
-#define NDEFAULT 8
+#define NDEFAULT 9
 
 JNIEXPORT jintArray JNICALL
 Java_sun_print_Win32PrintService_getDefaultSettings(JNIEnv *env,
@@ -859,6 +859,11 @@
       defIndices[7] = pDevMode->dmCollate;
   }
 
+  if (pDevMode->dmFields & DM_COLOR) {
+      defIndices[8] = pDevMode->dmColor;
+  }
+
+
   GlobalFree(pDevMode);
   ::ClosePrinter(hPrinter);
 
--- a/src/windows/native/sun/windows/awt_PrintControl.cpp	Tue Jun 18 15:32:53 2013 -0700
+++ b/src/windows/native/sun/windows/awt_PrintControl.cpp	Wed Jun 19 17:57:12 2013 -0700
@@ -252,7 +252,7 @@
     AwtPrintControl::getCopiesID =
       env->GetMethodID(cls, "getCopiesAttrib", "()I");
     AwtPrintControl::getCollateID =
-      env->GetMethodID(cls, "getCollateAttrib","()Z");
+      env->GetMethodID(cls, "getCollateAttrib","()I");
     AwtPrintControl::getOrientID =
       env->GetMethodID(cls, "getOrientAttrib", "()I");
     AwtPrintControl::getFromPageID =
@@ -690,12 +690,6 @@
     pd.Flags = PD_ENABLEPRINTHOOK | PD_RETURNDC | PD_USEDEVMODECOPIESANDCOLLATE;
     pd.lpfnPrintHook = (LPPRINTHOOKPROC)PrintDlgHook;
 
-    if (env->CallBooleanMethod(printCtrl, AwtPrintControl::getCollateID)) {
-        pd.Flags |= PD_COLLATE;
-    }
-
-    pd.nCopies = (WORD)env->CallIntMethod(printCtrl,
-                                          AwtPrintControl::getCopiesID);
     pd.nFromPage = (WORD)env->CallIntMethod(printCtrl,
                                             AwtPrintControl::getFromPageID);
     pd.nToPage = (WORD)env->CallIntMethod(printCtrl,
@@ -729,37 +723,52 @@
       DEVMODE *devmode = (DEVMODE *)::GlobalLock(pd.hDevMode);
       DASSERT(!IsBadWritePtr(devmode, sizeof(DEVMODE)));
 
-      devmode->dmFields |= DM_COPIES | DM_COLLATE | DM_ORIENTATION |
-          DM_PAPERSIZE | DM_PRINTQUALITY | DM_COLOR | DM_DUPLEX;
-
-      devmode->dmCopies = pd.nCopies;
+      WORD copies = (WORD)env->CallIntMethod(printCtrl,
+                                             AwtPrintControl::getCopiesID);
+      if (copies > 0) {
+          devmode->dmFields |= DM_COPIES;
+          devmode->dmCopies = copies;
+      }
 
       jint orient = env->CallIntMethod(printCtrl,
                                        AwtPrintControl::getOrientID);
-      if (orient == 0) {
+      if (orient == 0) {  // PageFormat.LANDSCAPE == 0
+        devmode->dmFields |= DM_ORIENTATION;
         devmode->dmOrientation = DMORIENT_LANDSCAPE;
-      } else if (orient == 1) {
+      } else if (orient == 1) { // PageFormat.PORTRAIT == 1
+        devmode->dmFields |= DM_ORIENTATION;
         devmode->dmOrientation = DMORIENT_PORTRAIT;
       }
 
-      devmode->dmCollate = (pd.Flags & PD_COLLATE) ? DMCOLLATE_TRUE
-        : DMCOLLATE_FALSE;
+      // -1 means unset, so we'll accept the printer default.
+      int collate = env->CallIntMethod(printCtrl,
+                                       AwtPrintControl::getCollateID);
+      if (collate == 1) {
+        devmode->dmFields |= DM_COLLATE;
+        devmode->dmCollate = DMCOLLATE_TRUE;
+      } else if (collate == 0) {
+        devmode->dmFields |= DM_COLLATE;
+        devmode->dmCollate = DMCOLLATE_FALSE;
+      }
 
       int quality = env->CallIntMethod(printCtrl,
                                        AwtPrintControl::getQualityID);
       if (quality) {
+        devmode->dmFields |= DM_PRINTQUALITY;
         devmode->dmPrintQuality = quality;
       }
 
       int color = env->CallIntMethod(printCtrl,
                                      AwtPrintControl::getColorID);
       if (color) {
+        devmode->dmFields |= DM_COLOR;
         devmode->dmColor = color;
       }
 
       int sides = env->CallIntMethod(printCtrl,
                                      AwtPrintControl::getSidesID);
       if (sides) {
+        devmode->dmFields |= DM_DUPLEX;
         devmode->dmDuplex = (int)sides;
       }
 
@@ -771,6 +780,7 @@
 
       double newWid = 0.0, newHt = 0.0;
       if (wid_ht != NULL && wid_ht[0] != 0 && wid_ht[1] != 0) {
+        devmode->dmFields |= DM_PAPERSIZE;
         devmode->dmPaperSize = AwtPrintControl::getNearestMatchingPaper(
                                              printName,
                                              portName,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/font/TextLayout/KerningLeak.java	Wed Jun 19 17:57:12 2013 -0700
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+/**
+ * @bug 8015334
+ * @summary Memory leak with kerning.
+ */
+
+import java.awt.EventQueue;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.font.TextAttribute;
+import java.util.HashMap;
+import java.util.Map;
+import javax.swing.JLabel;
+import javax.swing.SwingUtilities;
+
+public class KerningLeak {
+
+    public static void main(String[] args) {
+        EventQueue.invokeLater(new Runnable() {
+            @Override
+            public void run() {
+                leak();
+            }
+        });
+    }
+
+    private static void leak() {
+        Map<TextAttribute, Object> textAttributes = new HashMap<>();
+        textAttributes.put(TextAttribute.FAMILY, "Sans Serif");
+        textAttributes.put(TextAttribute.SIZE, 12);
+        textAttributes.put(TextAttribute.KERNING, TextAttribute.KERNING_ON);
+        Font font = Font.getFont(textAttributes);
+        JLabel label = new JLabel();
+        int dummy = 0;
+        for (int i = 0; i < 500; i++) {
+            if (i % 10 == 0) System.out.println("Starting iter " + (i+1));
+            for (int j = 0; j <1000; j++) {
+                FontMetrics fm = label.getFontMetrics(font);
+                dummy += SwingUtilities.computeStringWidth(fm, Integer.toString(j));
+            }
+        }
+        System.out.println("done " + dummy);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/javax/print/PrintServiceLookup/GetPrintServices.java	Wed Jun 19 17:57:12 2013 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+import javax.print.PrintService;
+import javax.print.PrintServiceLookup;
+import javax.print.attribute.AttributeSet;
+import javax.print.attribute.HashAttributeSet;
+import javax.print.attribute.standard.PrinterName;
+
+/*
+ * @test
+ * @bug 8013810
+ * @summary Test that print service returned without filter are of the same class as with name filter
+ */
+public class GetPrintServices {
+
+  public static void main(String[] args) throws Exception {
+    for (PrintService service : PrintServiceLookup.lookupPrintServices(null, null)) {
+      String serviceName = service.getName();
+      PrintService serviceByName = lookupByName(serviceName);
+      if (!service.equals(serviceByName)) {
+        throw new RuntimeException("NOK " + serviceName
+                                   + " expected: " + service.getClass().getName()
+                                   + " got: " + serviceByName.getClass().getName());
+      }
+    }
+    System.out.println("Test PASSED");
+  }
+
+  private static PrintService lookupByName(String name) {
+    AttributeSet attributes = new HashAttributeSet();
+    attributes.add(new PrinterName(name, null));
+    for (PrintService service : PrintServiceLookup.lookupPrintServices(null, attributes)) {
+      return service;
+    }
+    return null;
+  }
+}
--- a/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java	Tue Jun 18 15:32:53 2013 -0700
+++ b/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java	Wed Jun 19 17:57:12 2013 -0700
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 6476665 7033534
+ * @bug 6476665 7033534 6830714
  * @summary Verifies color conversion of Component Color Model based images
  * @run main ColConvCCMTest
  */
@@ -57,9 +57,9 @@
     final static double [] ACCURACY = {
     // Accuracy for color conversions
         2.5,        // sRGB
-        6.5,        // LINEAR_RGB
+        (isOpenProfile() ? 45.0 : 10.1), // LINEAR_RGB
         10.5,       // GRAY
-        45.5,       // PYCC
+        (isOpenProfile() ? 207 : 45.5), // PYCC
         47.5        // CIEXYZ
     };
 
--- a/test/sun/java2d/cmm/ColorConvertOp/ColConvDCMTest.java	Tue Jun 18 15:32:53 2013 -0700
+++ b/test/sun/java2d/cmm/ColorConvertOp/ColConvDCMTest.java	Wed Jun 19 17:57:12 2013 -0700
@@ -62,7 +62,11 @@
         ColorSpace.CS_LINEAR_RGB,
     };
 
-    final static double ACCURACY = 2.5;
+    final static double [] ACCURACY = {
+        // Accuracy for color conversions
+        2.5, // sRGB
+        (isOpenProfile() ? 45.0 : 2.5), // LINEAR_RGB
+    };
 
     final static String [] gldImgNames = {
         "SRGB.png", "SRGB555.png", "SRGB565.png", "LRGB.png", "LRGB555.png",
@@ -142,7 +146,7 @@
 
             if (!testImage(imgTypes[i][0], imgTypes[i][1], imgTypes[i][2],
                            imgTypes[i][3], cSpaces[imgTypes[i][4]], gldImage,
-                           ACCURACY))
+                           ACCURACY[imgTypes[i][4]]))
             {
                 throw new RuntimeException(
                     "Invalid result of the ColorConvertOp for " +
@@ -154,7 +158,8 @@
 
             if (!testSubImage(SI_X, SI_Y, SI_W, SI_H, imgTypes[i][0],
                               imgTypes[i][1], imgTypes[i][2], imgTypes[i][3],
-                              cSpaces[imgTypes[i][4]], gldImage, ACCURACY))
+                              cSpaces[imgTypes[i][4]], gldImage,
+                              ACCURACY[imgTypes[i][4]]))
             {
                 throw new RuntimeException(
                     "Invalid result of the ColorConvertOp for " +
--- a/test/sun/java2d/cmm/ColorConvertOp/ColConvTest.java	Tue Jun 18 15:32:53 2013 -0700
+++ b/test/sun/java2d/cmm/ColorConvertOp/ColConvTest.java	Wed Jun 19 17:57:12 2013 -0700
@@ -22,6 +22,7 @@
  */
 
 import java.awt.color.ColorSpace;
+import java.awt.color.ICC_Profile;
 import java.awt.image.BufferedImage;
 import java.awt.image.DataBuffer;
 
@@ -126,4 +127,33 @@
     public boolean isPassed() {
         return passed;
     }
+
+    private static Boolean isOpenProfile = null;
+
+    public static boolean isOpenProfile() {
+        if (isOpenProfile == null) {
+            ICC_Profile p = ICC_Profile.getInstance(ColorSpace.CS_sRGB);
+
+            byte[] h = p.getData(ICC_Profile.icSigHead);
+
+            if (h == null || h.length < 128) {
+                throw new RuntimeException("Test failed: invalid sRGB header");
+            }
+
+            final byte[] lcmsID = new byte[] {
+                (byte)0x6c, // l
+                (byte)0x63, // c
+                (byte)0x6d, // m
+                (byte)0x73, // s
+            };
+
+            int off = ICC_Profile.icHdrCmmId;
+
+            isOpenProfile = ((h[off + 0] == lcmsID[0])
+                    && (h[off + 1] == lcmsID[1])
+                    && (h[off + 2] == lcmsID[2])
+                    && (h[off + 3] == lcmsID[3]));
+        }
+        return isOpenProfile;
+    }
 }