Merge
authorprr
Mon, 22 Sep 2014 12:06:36 -0700
changeset 26757 38c52f39b931
parent 26756 2f8b9266922b (current diff)
parent 26726 16c5bcc0bed4 (diff)
child 26758 e4e2ba08614b
child 27049 083369e8f426
Merge
--- a/jdk/src/java.base/share/classes/java/net/CookieManager.java	Mon Sep 22 15:57:34 2014 +0100
+++ b/jdk/src/java.base/share/classes/java/net/CookieManager.java	Mon Sep 22 12:06:36 2014 -0700
@@ -368,7 +368,7 @@
         int val = -1;
         while (i > 0) {
             try {
-                val = Integer.parseInt(lst.substring(0, i));
+                val = Integer.parseInt(lst, 0, i, 10);
                 if (val == port) {
                     return true;
                 }
--- a/jdk/src/java.base/share/classes/java/net/URI.java	Mon Sep 22 15:57:34 2014 +0100
+++ b/jdk/src/java.base/share/classes/java/net/URI.java	Mon Sep 22 12:06:36 2014 -0700
@@ -3250,7 +3250,7 @@
                 if (q > p) {
                     checkChars(p, q, L_DIGIT, H_DIGIT, "port number");
                     try {
-                        port = Integer.parseInt(substring(p, q));
+                        port = Integer.parseInt(input, p, q, 10);
                     } catch (NumberFormatException x) {
                         fail("Malformed port number", p);
                     }
@@ -3271,7 +3271,7 @@
             int p = start;
             int q = scan(p, n, L_DIGIT, H_DIGIT);
             if (q <= p) return q;
-            if (Integer.parseInt(substring(p, q)) > 255) return p;
+            if (Integer.parseInt(input, p, q, 10) > 255) return p;
             return q;
         }
 
--- a/jdk/src/java.base/share/classes/java/net/URLDecoder.java	Mon Sep 22 15:57:34 2014 +0100
+++ b/jdk/src/java.base/share/classes/java/net/URLDecoder.java	Mon Sep 22 12:06:36 2014 -0700
@@ -171,7 +171,7 @@
 
                     while ( ((i+2) < numChars) &&
                             (c=='%')) {
-                        int v = Integer.parseInt(s.substring(i+1,i+3),16);
+                        int v = Integer.parseInt(s, i + 1, i + 3, 16);
                         if (v < 0)
                             throw new IllegalArgumentException("URLDecoder: Illegal hex characters in escape (%) pattern - negative value");
                         bytes[pos++] = (byte) v;
--- a/jdk/src/java.base/share/classes/java/net/URLStreamHandler.java	Mon Sep 22 15:57:34 2014 +0100
+++ b/jdk/src/java.base/share/classes/java/net/URLStreamHandler.java	Mon Sep 22 12:06:36 2014 -0700
@@ -196,7 +196,8 @@
                                 ++ind ;
                                 // port can be null according to RFC2396
                                 if (nhost.length() > (ind + 1)) {
-                                    port = Integer.parseInt(nhost.substring(ind+1));
+                                    port = Integer.parseInt(nhost, ind + 1,
+                                        nhost.length(), 10);
                                 }
                             } else {
                                 throw new IllegalArgumentException(
@@ -213,7 +214,8 @@
                     if (ind >= 0) {
                         // port can be null according to RFC2396
                         if (host.length() > (ind + 1)) {
-                            port = Integer.parseInt(host.substring(ind + 1));
+                            port = Integer.parseInt(host, ind + 1,
+                                    host.length(), 10);
                         }
                         host = host.substring(0, ind);
                     }
--- a/jdk/src/java.base/share/classes/sun/misc/FloatingDecimal.java	Mon Sep 22 15:57:34 2014 +0100
+++ b/jdk/src/java.base/share/classes/sun/misc/FloatingDecimal.java	Mon Sep 22 12:06:36 2014 -0700
@@ -1992,21 +1992,32 @@
                         break expLoop; // stop parsing exponent.
                     }
                 }
-                int expLimit = BIG_DECIMAL_EXPONENT+nDigits+nTrailZero;
-                if ( expOverflow || ( expVal > expLimit ) ){
-                    //
-                    // The intent here is to end up with
-                    // infinity or zero, as appropriate.
-                    // The reason for yielding such a small decExponent,
-                    // rather than something intuitive such as
-                    // expSign*Integer.MAX_VALUE, is that this value
-                    // is subject to further manipulation in
-                    // doubleValue() and floatValue(), and I don't want
-                    // it to be able to cause overflow there!
-                    // (The only way we can get into trouble here is for
-                    // really outrageous nDigits+nTrailZero, such as 2 billion. )
-                    //
-                    decExp = expSign*expLimit;
+                int expLimit = BIG_DECIMAL_EXPONENT + nDigits + nTrailZero;
+                if (expOverflow || (expVal > expLimit)) {
+                    // There is still a chance that the exponent will be safe to
+                    // use: if it would eventually decrease due to a negative
+                    // decExp, and that number is below the limit.  We check for
+                    // that here.
+                    if (!expOverflow && (expSign == 1 && decExp < 0)
+                            && (expVal + decExp) < expLimit) {
+                        // Cannot overflow: adding a positive and negative number.
+                        decExp += expVal;
+                    } else {
+                        //
+                        // The intent here is to end up with
+                        // infinity or zero, as appropriate.
+                        // The reason for yielding such a small decExponent,
+                        // rather than something intuitive such as
+                        // expSign*Integer.MAX_VALUE, is that this value
+                        // is subject to further manipulation in
+                        // doubleValue() and floatValue(), and I don't want
+                        // it to be able to cause overflow there!
+                        // (The only way we can get into trouble here is for
+                        // really outrageous nDigits+nTrailZero, such as 2
+                        // billion.)
+                        //
+                        decExp = expSign * expLimit;
+                    }
                 } else {
                     // this should not overflow, since we tested
                     // for expVal > (MAX+N), where N >= abs(decExp)
--- a/jdk/src/java.base/share/classes/sun/net/TransferProtocolClient.java	Mon Sep 22 15:57:34 2014 +0100
+++ b/jdk/src/java.base/share/classes/sun/net/TransferProtocolClient.java	Mon Sep 22 12:06:36 2014 -0700
@@ -80,7 +80,7 @@
                 code = -1;
             } else {
                 try {
-                    code = Integer.parseInt(response.substring(0, 3));
+                    code = Integer.parseInt(response, 0, 3, 10);
                 } catch (NumberFormatException e) {
                     code = -1;
                 } catch (StringIndexOutOfBoundsException e) {
--- a/jdk/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java	Mon Sep 22 15:57:34 2014 +0100
+++ b/jdk/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java	Mon Sep 22 12:06:36 2014 -0700
@@ -260,8 +260,8 @@
                 if (d != null && time != null) {
                     int c = time.indexOf(':');
                     now.setTime(d);
-                    now.set(Calendar.HOUR, Integer.parseInt(time.substring(0, c)));
-                    now.set(Calendar.MINUTE, Integer.parseInt(time.substring(c + 1)));
+                    now.set(Calendar.HOUR, Integer.parseInt(time, 0, c, 10));
+                    now.set(Calendar.MINUTE, Integer.parseInt(time, c + 1, time.length(), 10));
                     d = now.getTime();
                 }
                 // see if it's a symbolic link, i.e. the name if followed
@@ -437,7 +437,7 @@
                 code = -1;
             } else {
                 try {
-                    code = Integer.parseInt(response.substring(0, 3));
+                    code = Integer.parseInt(response, 0, 3, 10);
                 } catch (NumberFormatException e) {
                     code = -1;
                 } catch (StringIndexOutOfBoundsException e) {
--- a/jdk/src/java.base/share/classes/sun/net/www/ParseUtil.java	Mon Sep 22 15:57:34 2014 +0100
+++ b/jdk/src/java.base/share/classes/sun/net/www/ParseUtil.java	Mon Sep 22 12:06:36 2014 -0700
@@ -161,7 +161,7 @@
      * Un-escape and return the character at position i in string s.
      */
     private static byte unescape(String s, int i) {
-        return (byte) Integer.parseInt(s.substring(i+1,i+3),16);
+        return (byte) Integer.parseInt(s, i + 1, i + 3, 16);
     }
 
 
--- a/jdk/src/java.base/share/classes/sun/net/www/http/ChunkedInputStream.java	Mon Sep 22 15:57:34 2014 +0100
+++ b/jdk/src/java.base/share/classes/sun/net/www/http/ChunkedInputStream.java	Mon Sep 22 12:06:36 2014 -0700
@@ -313,7 +313,7 @@
                             break;
                     }
                     try {
-                        chunkSize = Integer.parseInt(header.substring(0, i), 16);
+                        chunkSize = Integer.parseInt(header, 0, i, 16);
                     } catch (NumberFormatException e) {
                         error = true;
                         throw new IOException("Bogus chunk size");
--- a/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java	Mon Sep 22 15:57:34 2014 +0100
+++ b/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java	Mon Sep 22 12:06:36 2014 -0700
@@ -808,7 +808,7 @@
             ind = resp.indexOf(' ');
             while(resp.charAt(ind) == ' ')
                 ind++;
-            code = Integer.parseInt(resp.substring(ind, ind + 3));
+            code = Integer.parseInt(resp, ind, ind + 3, 10);
         } catch (Exception e) {}
 
         if (code == HTTP_CONTINUE && ignoreContinue) {
--- a/jdk/src/java.base/unix/classes/sun/net/sdp/SdpProvider.java	Mon Sep 22 15:57:34 2014 +0100
+++ b/jdk/src/java.base/unix/classes/sun/net/sdp/SdpProvider.java	Mon Sep 22 12:06:36 2014 -0700
@@ -257,7 +257,8 @@
                             .getByName(s[1].substring(0, pos));
                         int prefix = -1;
                         try {
-                            prefix = Integer.parseInt(s[1].substring(pos+1));
+                            prefix = Integer.parseInt(s[1], pos + 1,
+                                s[1].length(), 10);
                             if (address instanceof Inet4Address) {
                                 // must be 1-31
                                 if (prefix < 0 || prefix > 32) prefix = -1;
--- a/jdk/src/jdk.attach/windows/native/libattach/VirtualMachineImpl.c	Mon Sep 22 15:57:34 2014 +0100
+++ b/jdk/src/jdk.attach/windows/native/libattach/VirtualMachineImpl.c	Mon Sep 22 12:06:36 2014 -0700
@@ -23,6 +23,7 @@
  * questions.
  */
 #include <windows.h>
+#include <Sddl.h>
 #include <string.h>
 
 #include "jni.h"
@@ -258,6 +259,25 @@
     HANDLE hPipe;
     char name[MAX_PIPE_NAME_LENGTH];
 
+    SECURITY_ATTRIBUTES sa;
+    LPSECURITY_ATTRIBUTES lpSA = NULL;
+    // Custom Security Descriptor is required here to "get" Medium Integrity Level.
+    // In order to allow Medium Integrity Level clients to open
+    // and use a NamedPipe created by an High Integrity Level process.
+    TCHAR *szSD = TEXT("D:")                  // Discretionary ACL
+                  TEXT("(A;OICI;GRGW;;;WD)")  // Allow read/write to Everybody
+                  TEXT("(A;OICI;GA;;;SY)")    // Allow full control to System
+                  TEXT("(A;OICI;GA;;;BA)");   // Allow full control to Administrators
+
+    sa.nLength = sizeof(SECURITY_ATTRIBUTES);
+    sa.bInheritHandle = FALSE;
+    sa.lpSecurityDescriptor = NULL;
+
+    if (ConvertStringSecurityDescriptorToSecurityDescriptor
+          (szSD, SDDL_REVISION_1, &(sa.lpSecurityDescriptor), NULL)) {
+        lpSA = &sa;
+    }
+
     jstring_to_cstring(env, pipename, name, MAX_PIPE_NAME_LENGTH);
 
     hPipe = CreateNamedPipe(
@@ -270,7 +290,9 @@
           128,                          // output buffer size
           8192,                         // input buffer size
           NMPWAIT_USE_DEFAULT_WAIT,     // client time-out
-          NULL);                        // default security attribute
+          lpSA);        // security attributes
+
+    LocalFree(sa.lpSecurityDescriptor);
 
     if (hPipe == INVALID_HANDLE_VALUE) {
         char msg[256];
--- a/jdk/test/ProblemList.txt	Mon Sep 22 15:57:34 2014 +0100
+++ b/jdk/test/ProblemList.txt	Mon Sep 22 12:06:36 2014 -0700
@@ -130,6 +130,12 @@
 # 8056143
 java/lang/management/MemoryMXBean/LowMemoryTest.java                                      generic-all
 
+# 8058492
+java/lang/management/ThreadMXBean/FindDeadlocks.java                                      generic-all
+
+# 8058506
+java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java                              generic-all
+
 ############################################################################
 
 # jdk_jmx
@@ -268,6 +274,9 @@
 # 8044419
 com/sun/jdi/JdbReadTwiceTest.sh                                 generic-all
 
+# 8058616
+com/sun/jdi/RedefinePop.sh                                      generic-all
+
 ############################################################################
 
 # jdk_util
@@ -298,4 +307,7 @@
 # 6456333
 sun/tools/jps/TestJpsJarRelative.java				generic-all
 
+# 8057732
+sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java    generic-all
+
 ############################################################################
--- a/jdk/test/java/lang/Double/ParseDouble.java	Mon Sep 22 15:57:34 2014 +0100
+++ b/jdk/test/java/lang/Double/ParseDouble.java	Mon Sep 22 12:06:36 2014 -0700
@@ -512,6 +512,21 @@
         "2.2250738585072014e-308",    // Double.MIN_NORMAL
 
         "2.2250738585072012e-308",    // near Double.MIN_NORMAL
+
+        "1.7976931348623158e+308",    // near MAX_VALUE + ulp(MAX_VALUE)/2
+        "1.7976931348623159e+308",    // near MAX_VALUE + ulp(MAX_VALUE)
+
+        "2.4703282292062329e-324",    // above MIN_VALUE/2
+        "2.4703282292062327e-324",    // MIN_VALUE/2
+        "2.4703282292062325e-324",    // below MIN_VALUE/2
+
+        // 1e308 with leading zeros
+
+        "0.0000000000001e321",
+        "00.000000000000000001e326",
+        "00000.000000000000000001e326",
+        "000.0000000000000000001e327",
+        "0.00000000000000000001e328",
     };
 
     static String paddedBadStrings[];