changeset 7765:8d5ff839420d

Merge
author asaha
date Tue, 19 Aug 2014 06:58:45 -0700
parents 9d2665bd31fa f3f5ea29b765
children ce607f747491
files .hgtags
diffstat 6 files changed, 161 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Mon Aug 18 10:32:46 2014 -0700
+++ b/.hgtags	Tue Aug 19 06:58:45 2014 -0700
@@ -457,6 +457,7 @@
 ba6cef21c369076be97dd8133fd4a158cd486bd8 jdk7u65-b19
 c3a56021fc22f886106f123d4f25b385ac6b79d7 jdk7u65-b32
 8b9d926bd35adceb99f244b7b068fedb0f220f03 jdk7u65-b20
+5cf343beab2ce73d299d4f1a8f3b95892f9fd818 jdk7u67-b01
 ba6cef21c369076be97dd8133fd4a158cd486bd8 jdk7u65-b40
 7b47a34063e94e1ab5636b11231d33fae92754c9 jdk7u65-b31
 4cb63f8ca9ee8c60d6f3d0051b69acc8392bd8de jdk7u65-b33
@@ -480,6 +481,8 @@
 0a05fabc719fe6c1ed02678d255f1250b32c30ed jdk7u71-b06
 48db48aab05e47cafc37b277f68a0e2ff5f1f0b6 jdk7u71-b07
 9ff013674339cb269280bfb4eaba40bba0584c40 jdk7u71-b08
+7e47a971eff7d78a459c23ee0d44b8f6c6c4c812 jdk7u71-b09
+919e84964279a058da2c8d4088c570c19543979f jdk7u71-b10
 c76a5b2876b98194ccbeffeab76a0326bf163ba2 jdk7u72-b01
 b02c1a8b10cd7338eb808ebfaa5a74b4997fdc8f jdk7u72-b02
 bc98cecdab4cd4a97316a5407c91bdedc92d4bb5 jdk7u72-b03
@@ -488,4 +491,6 @@
 b57a21af9f6d3cd9498099c329063a671b39e3c4 jdk7u72-b06
 9d53e2319954cc1479e190e26b110168c7073b0a jdk7u72-b07
 584b227e8efe21dd47a616afdb4f1f2a2fd630cf jdk7u72-b08
+2ee54b1c7203b9973e0b2ab06cf73e98886ee099 jdk7u72-b09
+d3257f2beb42163afe64adea65b53a18d039eb0d jdk7u72-b10
 87f9570ca734714f981d4a47477dcc6c80a7d324 jdk7u75-b00
--- a/src/share/classes/sun/security/smartcardio/CardImpl.java	Mon Aug 18 10:32:46 2014 -0700
+++ b/src/share/classes/sun/security/smartcardio/CardImpl.java	Tue Aug 19 06:58:45 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -26,9 +26,9 @@
 package sun.security.smartcardio;
 
 import java.nio.ByteBuffer;
-
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import javax.smartcardio.*;
-
 import static sun.security.smartcardio.PCSC.*;
 
 /**
@@ -62,6 +62,19 @@
     // thread holding exclusive access to the card, or null
     private volatile Thread exclusiveThread;
 
+    // used for platform specific logic
+    private static final boolean isWindows;
+
+    static {
+        final String osName = AccessController.doPrivileged(
+            new PrivilegedAction<String>() {
+                @Override public String run() {
+                    return System.getProperty("os.name");
+                }
+            });
+        isWindows = osName.startsWith("Windows");
+    }
+
     CardImpl(TerminalImpl terminal, String protocol) throws PCSCException {
         this.terminal = terminal;
         int sharingMode = SCARD_SHARE_SHARED;
@@ -74,7 +87,12 @@
             connectProtocol = SCARD_PROTOCOL_T1;
         } else if (protocol.equalsIgnoreCase("direct")) {
             // testing
-            connectProtocol = 0;
+
+            // MSDN states that the preferred protocol can be zero, but doesn't
+            //     specify whether other values are allowed.
+            // pcsc-lite implementation expects the preferred protocol to be non zero.
+            connectProtocol = isWindows ? 0 : SCARD_PROTOCOL_RAW;
+
             sharingMode = SCARD_SHARE_DIRECT;
         } else {
             throw new IllegalArgumentException("Unsupported protocol " + protocol);
--- a/src/solaris/classes/sun/awt/X11/XWindow.java	Mon Aug 18 10:32:46 2014 -0700
+++ b/src/solaris/classes/sun/awt/X11/XWindow.java	Tue Aug 19 06:58:45 2014 -0700
@@ -455,6 +455,7 @@
             ColorModel cm = getColorModel();
             int pixel = PixelConverter.instance.rgbToPixel(c.getRGB(), cm);
             XlibWrapper.XSetWindowBackground(XToolkit.getDisplay(), getContentWindow(), pixel);
+            XlibWrapper.XClearWindow(XToolkit.getDisplay(), getContentWindow());
         }
         finally {
             XToolkit.awtUnlock();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/java/awt/Window/BackgroundIsNotUpdated/BackgroundIsNotUpdated.java	Tue Aug 19 06:58:45 2014 -0700
@@ -0,0 +1,84 @@
+/*
+ * 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 java.awt.AWTException;
+import java.awt.Color;
+import java.awt.Frame;
+import java.awt.Graphics;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import java.awt.Window;
+
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 8001472
+ * @summary Background of the window should not depend from the paint()/update()
+ * @author Sergey Bylokhov
+ */
+public final class BackgroundIsNotUpdated extends Window {
+
+    public BackgroundIsNotUpdated(final Frame owner) {
+        super(owner);
+    }
+
+    @Override
+    public void paint(final Graphics ignored) {
+        // Intentionally left blank
+    }
+
+    @Override
+    public void update(final Graphics ignored) {
+        // Intentionally left blank
+    }
+
+    public static void main(final String[] args) throws AWTException {
+        final Window window = new BackgroundIsNotUpdated(null);
+        window.setSize(300, 300);
+        window.setLocationRelativeTo(null);
+        window.setVisible(true);
+        sleep();
+        window.setBackground(Color.GREEN);
+        sleep();
+        final Robot robot = new Robot();
+        robot.setAutoDelay(200);
+        Point point = window.getLocationOnScreen();
+        Color color = robot.getPixelColor(point.x + window.getWidth() / 2,
+                                          point.y + window.getHeight() / 2);
+        window.dispose();
+        if (!color.equals(Color.GREEN)) {
+            throw new RuntimeException(
+                    "Expected: " + Color.GREEN + " , Actual: " + color);
+        }
+    }
+
+    private static void sleep() {
+        try {
+            ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+            Thread.sleep(1000);
+        } catch (InterruptedException ignored) {
+        }
+    }
+}
--- a/test/sun/security/smartcardio/TestAll.java	Mon Aug 18 10:32:46 2014 -0700
+++ b/test/sun/security/smartcardio/TestAll.java	Tue Aug 19 06:58:45 2014 -0700
@@ -40,6 +40,7 @@
         TestMultiplePresent.class,
         TestPresent.class,
         TestTransmit.class,
+        TestDirect.class,
     };
 
     public static void main(String[] args) throws Exception {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/sun/security/smartcardio/TestDirect.java	Tue Aug 19 06:58:45 2014 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014, 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 8046343
+ * @summary Make sure that direct protocol is available
+ * @run main/manual TestDirect
+ */
+
+// This test requires special hardware.
+
+import javax.smartcardio.Card;
+import javax.smartcardio.CardTerminal;
+import javax.smartcardio.CardTerminals;
+import javax.smartcardio.TerminalFactory;
+
+public class TestDirect {
+    public static void main(String[] args) throws Exception {
+        TerminalFactory terminalFactory = TerminalFactory.getDefault();
+        CardTerminals cardTerminals = terminalFactory.terminals();
+        CardTerminal cardTerminal = cardTerminals.list().get(0);
+        Card card = cardTerminal.connect("DIRECT");
+        card.disconnect(true);
+
+        System.out.println("OK.");
+    }
+}