changeset 8939:8b6b930489cb icedtea-2.6.7

Merge jdk7u111-b01
author andrew
date Thu, 28 Jul 2016 14:59:45 +0100
parents 1bb8e0af0abe (current diff) 8364a54c9138 (diff)
children 78984f240864
files .hgtags src/share/classes/sun/misc/Version.java.template
diffstat 12 files changed, 70 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Jul 20 05:35:14 2016 +0100
+++ b/.hgtags	Thu Jul 28 14:59:45 2016 +0100
@@ -645,3 +645,4 @@
 55c38c1ace75384dcad2d3a95382e37a4bff94ef icedtea-2.6.6
 a55f33fff0541077cb8f2547899104783608a40f icedtea-2.6.7pre01
 a7267e8244b9418af15b1103b4d906e8c6a61bc0 jdk7u111-b00
+cc1ed9a351886645eb729144696e41d187564ec2 jdk7u111-b01
--- a/src/share/classes/com/sun/crypto/provider/DESKeyFactory.java	Wed Jul 20 05:35:14 2016 +0100
+++ b/src/share/classes/com/sun/crypto/provider/DESKeyFactory.java	Thu Jul 28 14:59:45 2016 +0100
@@ -92,7 +92,7 @@
      * inappropriate for the given key, or the given key cannot be processed
      * (e.g., the given key has an unrecognized algorithm or format).
      */
-    protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpec)
+    protected KeySpec engineGetKeySpec(SecretKey key, Class keySpec)
         throws InvalidKeySpecException {
 
         try {
--- a/src/share/classes/com/sun/crypto/provider/DESedeKeyFactory.java	Wed Jul 20 05:35:14 2016 +0100
+++ b/src/share/classes/com/sun/crypto/provider/DESedeKeyFactory.java	Thu Jul 28 14:59:45 2016 +0100
@@ -92,7 +92,7 @@
      * inappropriate for the given key, or the given key cannot be processed
      * (e.g., the given key has an unrecognized algorithm or format).
      */
-    protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpec)
+    protected KeySpec engineGetKeySpec(SecretKey key, Class keySpec)
         throws InvalidKeySpecException {
 
         try {
--- a/src/share/classes/com/sun/crypto/provider/PBEKeyFactory.java	Wed Jul 20 05:35:14 2016 +0100
+++ b/src/share/classes/com/sun/crypto/provider/PBEKeyFactory.java	Thu Jul 28 14:59:45 2016 +0100
@@ -131,7 +131,7 @@
      * inappropriate for the given key, or the given key cannot be processed
      * (e.g., the given key has an unrecognized algorithm or format).
      */
-    protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpecCl)
+    protected KeySpec engineGetKeySpec(SecretKey key, Class keySpecCl)
         throws InvalidKeySpecException {
         if ((key instanceof SecretKey)
             && (validTypes.contains(key.getAlgorithm().toUpperCase()))
--- a/src/share/classes/com/sun/crypto/provider/PBKDF2HmacSHA1Factory.java	Wed Jul 20 05:35:14 2016 +0100
+++ b/src/share/classes/com/sun/crypto/provider/PBKDF2HmacSHA1Factory.java	Thu Jul 28 14:59:45 2016 +0100
@@ -86,7 +86,7 @@
      * given key cannot be processed (e.g., the given key has an
      * unrecognized algorithm or format).
      */
-    protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpecCl)
+    protected KeySpec engineGetKeySpec(SecretKey key, Class keySpecCl)
         throws InvalidKeySpecException {
         if (key instanceof javax.crypto.interfaces.PBEKey) {
             // Check if requested key spec is amongst the valid ones
--- a/src/share/classes/javax/crypto/SecretKeyFactory.java	Wed Jul 20 05:35:14 2016 +0100
+++ b/src/share/classes/javax/crypto/SecretKeyFactory.java	Thu Jul 28 14:59:45 2016 +0100
@@ -368,7 +368,7 @@
      * (e.g., the given key has an algorithm or format not supported by this
      * secret-key factory).
      */
-    public final KeySpec getKeySpec(SecretKey key, Class<?> keySpec)
+    public final KeySpec getKeySpec(SecretKey key, Class keySpec)
             throws InvalidKeySpecException {
         if (serviceIterator == null) {
             return spi.engineGetKeySpec(key, keySpec);
--- a/src/share/classes/javax/crypto/SecretKeyFactorySpi.java	Wed Jul 20 05:35:14 2016 +0100
+++ b/src/share/classes/javax/crypto/SecretKeyFactorySpi.java	Thu Jul 28 14:59:45 2016 +0100
@@ -88,7 +88,7 @@
      * (e.g., the given key has an algorithm or format not supported by this
      * secret-key factory).
      */
-    protected abstract KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpec)
+    protected abstract KeySpec engineGetKeySpec(SecretKey key, Class keySpec)
         throws InvalidKeySpecException;
 
     /**
--- a/src/share/classes/sun/misc/Version.java.template	Wed Jul 20 05:35:14 2016 +0100
+++ b/src/share/classes/sun/misc/Version.java.template	Thu Jul 28 14:59:45 2016 +0100
@@ -313,15 +313,24 @@
                 jvm_minor_version = Character.digit(cs.charAt(2), 10);
                 jvm_micro_version = Character.digit(cs.charAt(4), 10);
                 cs = cs.subSequence(5, cs.length());
-                if (cs.charAt(0) == '_' && cs.length() >= 3 &&
-                    Character.isDigit(cs.charAt(1)) &&
-                    Character.isDigit(cs.charAt(2))) {
-                    int nextChar = 3;
+                if (cs.charAt(0) == '_' && cs.length() >= 3) {
+                    int nextChar = 0;
+                    if (Character.isDigit(cs.charAt(1)) &&
+                        Character.isDigit(cs.charAt(2)) &&
+                        Character.isDigit(cs.charAt(3)))
+                    {
+                        nextChar = 4;
+                    } else if (Character.isDigit(cs.charAt(1)) &&
+                        Character.isDigit(cs.charAt(2)))
+                    {
+                        nextChar = 3;
+                    }
+
                     try {
-                        String uu = cs.subSequence(1, 3).toString();
+                        String uu = cs.subSequence(1, nextChar).toString();
                         jvm_update_version = Integer.valueOf(uu).intValue();
-                        if (cs.length() >= 4) {
-                            char c = cs.charAt(3);
+                        if (cs.length() >= nextChar + 1) {
+                            char c = cs.charAt(nextChar);
                             if (c >= 'a' && c <= 'z') {
                                 jvm_special_version = Character.toString(c);
                                 nextChar++;
--- a/src/share/classes/sun/security/pkcs11/P11SecretKeyFactory.java	Wed Jul 20 05:35:14 2016 +0100
+++ b/src/share/classes/sun/security/pkcs11/P11SecretKeyFactory.java	Thu Jul 28 14:59:45 2016 +0100
@@ -319,7 +319,7 @@
     }
 
     // see JCE spec
-    protected KeySpec engineGetKeySpec(SecretKey key, Class<?> keySpec)
+    protected KeySpec engineGetKeySpec(SecretKey key, Class keySpec)
             throws InvalidKeySpecException {
         token.ensureValid();
         if ((key == null) || (keySpec == null)) {
--- a/src/share/classes/sun/security/provider/certpath/X509CertPath.java	Wed Jul 20 05:35:14 2016 +0100
+++ b/src/share/classes/sun/security/provider/certpath/X509CertPath.java	Thu Jul 28 14:59:45 2016 +0100
@@ -105,7 +105,13 @@
         super("X.509");
 
         // Ensure that the List contains only X509Certificates
-        for (Certificate obj : certs) {
+        //
+        // Note; The certs parameter is not necessarily to be of Certificate
+        // for some old code. For compatibility, to make sure the exception
+        // is CertificateException, rather than ClassCastException, please
+        // don't use
+        //     for (Certificate obj : certs)
+        for (Object obj : certs) {
             if (obj instanceof X509Certificate == false) {
                 throw new CertificateException
                     ("List is not all X509Certificates: "
--- a/src/share/native/common/jdk_util.c	Wed Jul 20 05:35:14 2016 +0100
+++ b/src/share/native/common/jdk_util.c	Thu Jul 28 14:59:45 2016 +0100
@@ -52,7 +52,8 @@
 
     const char* jdk_update_string = JDK_UPDATE_VERSION;
     unsigned int jdk_update_version = 0;
-    char update_ver[3];
+    int len_update_ver = 0;
+    char update_ver[5];
     char jdk_special_version = '\0';
 
     /* If the JDK_BUILD_NUMBER is of format bXX and XX is an integer
@@ -78,16 +79,17 @@
 
     assert(jdk_build_number >= 0 && jdk_build_number <= 255);
 
-    if (strlen(jdk_update_string) == 2 || strlen(jdk_update_string) == 3) {
-        if (isdigit(jdk_update_string[0]) && isdigit(jdk_update_string[1])) {
-            update_ver[0] = jdk_update_string[0];
-            update_ver[1] = jdk_update_string[1];
-            update_ver[2] = '\0';
-            jdk_update_version = (unsigned int) atoi(update_ver);
-            if (strlen(jdk_update_string) == 3) {
-                jdk_special_version = jdk_update_string[2];
-            }
+    len_update_ver = strlen(jdk_update_string);
+    if (len_update_ver >= 2 && len_update_ver <= 4) {
+        int update_digits = len_update_ver;
+
+        if (!isdigit(jdk_update_string[len_update_ver - 1])) {
+            jdk_special_version = jdk_update_string[len_update_ver -1];
+            update_digits = len_update_ver - 1;
         }
+        strncpy(update_ver, jdk_update_string, update_digits);
+        update_ver[update_digits] = '\0';
+        jdk_update_version = (unsigned int) atoi(update_ver);
     }
 
     memset(info, 0, info_size);
--- a/test/sun/misc/Version/Version.java	Wed Jul 20 05:35:14 2016 +0100
+++ b/test/sun/misc/Version/Version.java	Thu Jul 28 14:59:45 2016 +0100
@@ -114,7 +114,7 @@
         regex +=   "([0-9]{1,2})";          // micro
         regex += ")?";                      // micro is optional
         regex += "(_";
-        regex +=   "([0-9]{2})";            // update
+        regex +=   "([0-9]{2,3})";          // update
         regex +=   "([a-z])?";              // special char (optional)
         regex += ")?";                      // _uu[c] is optional
         regex += ".*";                      // -<identifier>
@@ -132,33 +132,38 @@
         build = Integer.parseInt(m.group(9));
 
         VersionInfo vi = new VersionInfo(major, minor, micro, update, special, build);
-        System.out.printf("newVersionInfo: input=%s output=%s\n", version, vi);
+        System.out.printf("jdkVersionInfo: input=%s output=%s\n", version, vi);
         return vi;
     }
 
     private static VersionInfo jvmVersionInfo(String version) throws Exception {
-        // valid format of the version string is:
-        // <major>.<minor>-bxx[-<identifier>][-<debug_flavor>]
-        int major = 0;
-        int minor = 0;
-        int build = 0;
+        try {
+            // valid format of the version string is:
+            // <major>.<minor>-bxx[-<identifier>][-<debug_flavor>]
+            int major = 0;
+            int minor = 0;
+            int build = 0;
 
-        String regex = "^([0-9]{1,2})";     // major
-        regex += "\\.";                     // separator
-        regex += "([0-9]{1,2})";            // minor
-        regex += "(\\-b([0-9]{1,3}))";      // JVM -bxx
-        regex += ".*";
+            String regex = "^([0-9]{1,2})";     // major
+            regex += "\\.";                     // separator
+            regex += "([0-9]{1,3})";            // minor
+            regex += "(\\-b([0-9]{1,3}))";      // JVM -bxx
+            regex += ".*";
 
-        Pattern p = Pattern.compile(regex);
-        Matcher m = p.matcher(version);
-        m.matches();
+            Pattern p = Pattern.compile(regex);
+            Matcher m = p.matcher(version);
+            m.matches();
+
+            major = Integer.parseInt(m.group(1));
+            minor = Integer.parseInt(m.group(2));
+            build = Integer.parseInt(m.group(4));
 
-        major = Integer.parseInt(m.group(1));
-        minor = Integer.parseInt(m.group(2));
-        build = Integer.parseInt(m.group(4));
-
-        VersionInfo vi = new VersionInfo(major, minor, 0, 0, "", build);
-        System.out.printf("newVersionInfo: input=%s output=%s\n", version, vi);
-        return vi;
+            VersionInfo vi = new VersionInfo(major, minor, 0, 0, "", build);
+            System.out.printf("jvmVersionInfo: input=%s output=%s\n", version, vi);
+            return vi;
+        } catch (IllegalStateException e) {
+            // local builds may also follow the jdkVersionInfo format
+            return jdkVersionInfo(version);
+        }
     }
 }