7130985: Four helper classes missing in Sun JDK
authorrobm
Mon, 08 Jun 2015 21:35:36 +0100
changeset 31063 4338d96ed321
parent 31062 a6b5f444cb68
child 31078 df8046e65630
7130985: Four helper classes missing in Sun JDK Reviewed-by: coffeys, msheppar
jdk/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java
jdk/test/com/sun/corba/7130985/CorbaExceptionsCompileTest.java
jdk/test/com/sun/corba/7130985/CorbaExceptionsTest.java
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java	Mon Jun 08 16:17:37 2015 +0300
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java	Mon Jun 08 21:35:36 2015 +0100
@@ -28,6 +28,7 @@
 import java.security.AlgorithmConstraints;
 import java.security.CryptoPrimitive;
 import java.security.PrivateKey;
+import java.security.Security;
 
 import java.util.Set;
 import java.util.HashSet;
@@ -415,10 +416,12 @@
                     "SHA1withRSA",          --p);
             supports(HashAlgorithm.SHA1,        SignatureAlgorithm.ECDSA,
                     "SHA1withECDSA",        --p);
+            if (Security.getProvider("SunMSCAPI") == null) {
             supports(HashAlgorithm.SHA224,      SignatureAlgorithm.RSA,
                     "SHA224withRSA",        --p);
             supports(HashAlgorithm.SHA224,      SignatureAlgorithm.ECDSA,
                     "SHA224withECDSA",      --p);
+            }
             supports(HashAlgorithm.SHA256,      SignatureAlgorithm.RSA,
                     "SHA256withRSA",        --p);
             supports(HashAlgorithm.SHA256,      SignatureAlgorithm.ECDSA,
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/corba/7130985/CorbaExceptionsCompileTest.java	Mon Jun 08 21:35:36 2015 +0100
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2015, 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 7130985
+ * @summary Four helper classes missing in Sun JDK
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.*
+ * @run main CorbaExceptionsCompileTest
+ */
+
+import java.io.*;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.rmi.RemoteException;
+import org.omg.CORBA.ORBPackage.InvalidName;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.TypeCodePackage.Bounds;
+
+import jdk.testlibrary.FileUtils;
+import jdk.testlibrary.JDKToolLauncher;
+
+public class CorbaExceptionsCompileTest implements CorbaExceptionsTest {
+
+    public CorbaExceptionsCompileTest() {
+        super();
+    }
+
+    public void testExceptionInvalidName()
+        throws java.rmi.RemoteException, InvalidName {}
+
+    public void testExceptionBounds()
+        throws java.rmi.RemoteException, Bounds {}
+
+    public void testExceptionBadKind()
+        throws java.rmi.RemoteException, BadKind {}
+
+    public void testExceptionCorba_Bounds()
+        throws java.rmi.RemoteException, org.omg.CORBA.Bounds {}
+
+    public static void main(String[] args) throws Exception {
+        final File f = new File(
+            CorbaExceptionsCompileTest.class.getProtectionDomain()
+                .getCodeSource().getLocation().getPath());
+        System.out.println(f.getCanonicalPath());
+        ProcessBuilder pb = new ProcessBuilder("ls", "-l");
+        pb.directory(f);
+        Process p = pb.start();
+        p.waitFor();
+        if (p.exitValue() == 0) {
+            try (BufferedReader br = new BufferedReader(
+                    new InputStreamReader(p.getInputStream()))) {
+                StringBuilder builder = new StringBuilder();
+                String line = null;
+                while ( (line = br.readLine()) != null) {
+                    builder.append(line + "\n");
+                }
+                String result = builder.toString();
+                System.out.println(result);
+            }
+        }
+
+        Path outDir = Paths.get("CorbaExceptionsCompileTest-compiled");
+        outDir = Files.createDirectory(outDir).toAbsolutePath();
+        JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("rmic");
+        launcher.addToolArg("-classpath").addToolArg(f.getCanonicalPath())
+            .addToolArg("-d").addToolArg(outDir.toString())
+            .addToolArg("-iiop").addToolArg("CorbaExceptionsCompileTest");
+
+        pb = new ProcessBuilder(launcher.getCommand());
+        pb.directory(f);
+        System.out.println("Working Directory: " + pb.directory());
+        System.out.println("CorbaExceptionsCompileTest.class exists: "
+            + new File(f, "CorbaExceptionsCompileTest.class").exists());
+
+        p = pb.start();
+        p.waitFor();
+        if (p.exitValue() != 0) {
+            try (BufferedReader br = new BufferedReader(
+                    new InputStreamReader(p.getInputStream()))) {
+                StringBuilder builder = new StringBuilder();
+                String line = null;
+                while ( (line = br.readLine()) != null) {
+                    builder.append(line + "\n");
+                }
+                String result = builder.toString();
+                System.out.println(result);
+                throw new RuntimeException(launcher.getCommand() +
+                    " -iiop CorbaExceptionsCompileTest failed with status: "
+                    + p.exitValue());
+            }
+        }
+
+        if (Files.exists(outDir))
+            FileUtils.deleteFileTreeWithRetry(outDir);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/com/sun/corba/7130985/CorbaExceptionsTest.java	Mon Jun 08 21:35:36 2015 +0100
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2015, 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.rmi.Remote;
+import org.omg.CORBA.ORBPackage.InvalidName;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.TypeCodePackage.Bounds;
+
+public interface CorbaExceptionsTest extends Remote {
+     public void testExceptionInvalidName() throws java.rmi.RemoteException, InvalidName;
+     public void testExceptionBounds() throws java.rmi.RemoteException, Bounds;
+     public void testExceptionBadKind() throws java.rmi.RemoteException, BadKind;
+     public void testExceptionCorba_Bounds() throws java.rmi.RemoteException, org.omg.CORBA.Bounds;
+}
+