changeset 2624:93fe1e8a9277

Merge
author Andrew John Hughes <ahughes@redhat.com>
date Tue, 28 Jun 2011 17:21:18 +0100
parents 7183dbf25d56 (current diff) 411743c2dd64 (diff)
children 3c66636f2c6f
files ChangeLog Makefile.am
diffstat 5 files changed, 257 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Jun 28 17:18:45 2011 +0100
+++ b/ChangeLog	Tue Jun 28 17:21:18 2011 +0100
@@ -1,3 +1,17 @@
+2011-06-28  Pavel Tisnovsky  <ptisnovs@redhat.com>
+
+	* Makefile.am: added new patch
+	* NEWS: updated with backport
+	* patches/openjdk/6785424-SecurityException_locating_physical_fonts.patch:
+	Backport of 6785424 fix.
+
+2011-06-28  Pavel Tisnovsky  <ptisnovs@redhat.com>
+
+	* Makefile.am: added new patch
+	* NEWS: updated with backport
+	* patches/openjdk/6783910-java_awt_Color_brighter_darker_fix.patch:
+	Backport of 6783910 fix.
+
 2011-06-28  Andrew John Hughes  <ahughes@redhat.com>
 
 	* Makefile.am: Add new patch.
--- a/Makefile.am	Tue Jun 28 17:18:45 2011 +0100
+++ b/Makefile.am	Tue Jun 28 17:21:18 2011 +0100
@@ -368,7 +368,9 @@
 	patches/openjdk/6699843-IllegalArgumentException_drawString.patch \
 	patches/openjdk/6918065-Crash_in_Java2D_blit_loop.patch \
 	patches/openjdk/6623219-Font_canDisplayUpTo_does_not_work.patch \
-	patches/support_linux_3.patch
+	patches/support_linux_3.patch \
+	patches/openjdk/6783910-java_awt_Color_brighter_darker_fix.patch \
+	patches/openjdk/6785424-SecurityException_locating_physical_fonts.patch
 
 if WITH_ALT_HSBUILD
 ICEDTEA_PATCHES += \
--- a/NEWS	Tue Jun 28 17:18:45 2011 +0100
+++ b/NEWS	Tue Jun 28 17:21:18 2011 +0100
@@ -39,6 +39,8 @@
   - S6699843: IllegalArgumentException when using Graphics.drawString( "", 0, 0 )
   - S6918065: Crash in Java2D blit loop (IntArgbToIntArgbPreSrcOverMaskBlit) in 64bit mode
   - S6623219: Font.canDisplayUpTo does not work with supplementary characters
+  - S6783910: java.awt.Color.brighter()/darker() methods make color opaque
+  - S6785424: SecurityException locating physical fonts on Windows Terminal Server
 * Bug fixes
   - PR637: make check should exit with an error code if any regression test failed.
   - G356743: Support libpng 1.5.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/openjdk/6783910-java_awt_Color_brighter_darker_fix.patch	Tue Jun 28 17:21:18 2011 +0100
@@ -0,0 +1,141 @@
+# HG changeset patch
+# User dav
+# Date 1291143295 -10800
+# Node ID 357ecafd727b56555e8adc7dd39bfa01abdd12f7
+# Parent  4becb3dd78618a7d211778d8b1d1f0029512f5fb
+6783910: (dav) java.awt.Color.brighter()/darker() methods make color opaque
+Reviewed-by: art, yan
+
+diff -r 4becb3dd7861 -r 357ecafd727b src/share/classes/java/awt/Color.java
+--- openjdk.orig/jdk/src/share/classes/java/awt/Color.java	Tue Nov 30 17:36:56 2010 +0300
++++ openjdk/jdk/src/share/classes/java/awt/Color.java	Tue Nov 30 21:54:55 2010 +0300
+@@ -611,12 +611,15 @@
+      * <p>
+      * This method applies an arbitrary scale factor to each of the three RGB
+      * components of this <code>Color</code> to create a brighter version
+-     * of this <code>Color</code>. Although <code>brighter</code> and
++     * of this <code>Color</code>.
++     * The {@code alpha} value is preserved.
++     * Although <code>brighter</code> and
+      * <code>darker</code> are inverse operations, the results of a
+      * series of invocations of these two methods might be inconsistent
+      * because of rounding errors.
+      * @return     a new <code>Color</code> object that is
+-     *                 a brighter version of this <code>Color</code>.
++     *                 a brighter version of this <code>Color</code>
++     *                 with the same {@code alpha} value.
+      * @see        java.awt.Color#darker
+      * @since      JDK1.0
+      */
+@@ -624,6 +627,7 @@
+         int r = getRed();
+         int g = getGreen();
+         int b = getBlue();
++        int alpha = getAlpha();
+ 
+         /* From 2D group:
+          * 1. black.brighter() should return grey
+@@ -632,7 +636,7 @@
+          */
+         int i = (int)(1.0/(1.0-FACTOR));
+         if ( r == 0 && g == 0 && b == 0) {
+-           return new Color(i, i, i);
++            return new Color(i, i, i, alpha);
+         }
+         if ( r > 0 && r < i ) r = i;
+         if ( g > 0 && g < i ) g = i;
+@@ -640,7 +644,8 @@
+ 
+         return new Color(Math.min((int)(r/FACTOR), 255),
+                          Math.min((int)(g/FACTOR), 255),
+-                         Math.min((int)(b/FACTOR), 255));
++                         Math.min((int)(b/FACTOR), 255),
++                         alpha);
+     }
+ 
+     /**
+@@ -649,19 +654,23 @@
+      * <p>
+      * This method applies an arbitrary scale factor to each of the three RGB
+      * components of this <code>Color</code> to create a darker version of
+-     * this <code>Color</code>.  Although <code>brighter</code> and
++     * this <code>Color</code>.
++     * The {@code alpha} value is preserved.
++     * Although <code>brighter</code> and
+      * <code>darker</code> are inverse operations, the results of a series
+      * of invocations of these two methods might be inconsistent because
+      * of rounding errors.
+      * @return  a new <code>Color</code> object that is
+-     *                    a darker version of this <code>Color</code>.
++     *                    a darker version of this <code>Color</code>
++     *                    with the same {@code alpha} value.
+      * @see        java.awt.Color#brighter
+      * @since      JDK1.0
+      */
+     public Color darker() {
+         return new Color(Math.max((int)(getRed()  *FACTOR), 0),
+                          Math.max((int)(getGreen()*FACTOR), 0),
+-                         Math.max((int)(getBlue() *FACTOR), 0));
++                         Math.max((int)(getBlue() *FACTOR), 0),
++                         getAlpha());
+     }
+ 
+     /**
+diff -r 4becb3dd7861 -r 357ecafd727b test/java/awt/Color/OpacityChange/OpacityChange.java
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ openjdk/jdk/test/java/awt/Color/OpacityChange/OpacityChange.java	Tue Nov 30 21:54:55 2010 +0300
+@@ -0,0 +1,54 @@
++/*
++ * 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 6783910
++  @summary java.awt.Color.brighter()/darker() methods make color opaque
++  @author Andrei Dmitriev: area=awt-color
++  @run main OpacityChange
++*/
++
++import java.awt.*;
++
++public class OpacityChange {
++    private final static int INITIAL_ALPHA = 125;
++
++    public static void main(String argv[]) {
++        Color color = new Color(20, 20, 20, INITIAL_ALPHA);
++        System.out.println("Initial alpha: " + color.getAlpha());
++        Color colorBrighter = color.brighter();
++        System.out.println("New alpha (after brighter): " + colorBrighter.getAlpha());
++
++        Color colorDarker = color.darker();
++        System.out.println("New alpha (after darker): " + colorDarker.getAlpha());
++
++
++        if (INITIAL_ALPHA != colorBrighter.getAlpha()) {
++            throw new RuntimeException("Brighter color alpha has changed from : " +INITIAL_ALPHA + " to " + colorBrighter.getAlpha());
++        }
++        if (INITIAL_ALPHA != colorDarker.getAlpha()) {
++            throw new RuntimeException("Darker color alpha has changed from : " +INITIAL_ALPHA + " to " + colorDarker.getAlpha());
++        }
++    }
++}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/openjdk/6785424-SecurityException_locating_physical_fonts.patch	Tue Jun 28 17:21:18 2011 +0100
@@ -0,0 +1,97 @@
+# HG changeset patch
+# User prr
+# Date 1231278723 28800
+# Node ID eaeaacda1c568a3e013ade338c9b833d767e8591
+# Parent  40ec164889bd9ec1955e36864593bc222474ba43
+6785424: SecurityException locating physical fonts on Windows Terminal Server
+Reviewed-by: campbell, jgodinez
+
+diff -r 40ec164889bd -r eaeaacda1c56 src/share/classes/sun/font/FontManager.java
+--- openjdk.orig/jdk/src/share/classes/sun/font/FontManager.java	Wed Dec 24 09:57:48 2008 -0800
++++ openjdk/jdk/src/share/classes/sun/font/FontManager.java	Tue Jan 06 13:52:03 2009 -0800
+@@ -1601,18 +1601,27 @@
+     /* Path may be absolute or a base file name relative to one of
+      * the platform font directories
+      */
+-    private static String getPathName(String s) {
++    private static String getPathName(final String s) {
+         File f = new File(s);
+         if (f.isAbsolute()) {
+             return s;
+         } else if (pathDirs.length==1) {
+             return pathDirs[0] + File.separator + s;
+         } else {
+-            for (int p=0; p<pathDirs.length; p++) {
+-                f = new File(pathDirs[p] + File.separator + s);
+-                if (f.exists()) {
+-                    return f.getAbsolutePath();
+-                }
++            String path = java.security.AccessController.doPrivileged(
++                 new java.security.PrivilegedAction<String>() {
++                     public String run() {
++                         for (int p=0; p<pathDirs.length; p++) {
++                             File f = new File(pathDirs[p] +File.separator+ s);
++                             if (f.exists()) {
++                                 return f.getAbsolutePath();
++                             }
++                         }
++                         return null;
++                     }
++                });
++            if (path != null) {
++                return path;
+             }
+         }
+         return s; // shouldn't happen, but harmless
+diff -r 40ec164889bd -r eaeaacda1c56 test/java/awt/FontClass/FontAccess.java
+--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
++++ openjdk/jdk/test/java/awt/FontClass/FontAccess.java	Tue Jan 06 13:52:03 2009 -0800
+@@ -0,0 +1,48 @@
++/*
++ * Copyright (c) 2009 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
++ * CA 95054 USA or visit www.sun.com if you need additional information or
++ * have any questions.
++ */
++
++/*
++ * @test
++ * @bug 6785424
++ * @summary Test no SecurityException searching for a font.
++ * @run main FontAccess
++ *
++ * This can only test the specific bug if run on something like
++ * Windows Citrix Server where SystemDirectory and WindowsDirectory
++ * are different locations.
++ */
++
++import java.awt.*;
++import java.awt.image.*;
++
++public class FontAccess {
++
++     public static void main(String[] args) {
++        System.setSecurityManager(new SecurityManager());
++        Font f = new Font("Verdana", Font.PLAIN, 12);
++        BufferedImage bi = new BufferedImage(1,1,1);
++        Graphics2D g = bi.createGraphics();
++        g.setFont(f);
++        System.out.println(g.getFontMetrics());
++     }
++}