jdk/src/java.base/share/classes/java/net/URLStreamHandler.java
changeset 26720 6b160d97c51d
parent 25859 3317bb8137f4
child 32649 2ee9017c7597
equal deleted inserted replaced
26719:2aa1709a8043 26720:6b160d97c51d
   194                         if (nhost.length() > ind+1) {
   194                         if (nhost.length() > ind+1) {
   195                             if (nhost.charAt(ind+1) == ':') {
   195                             if (nhost.charAt(ind+1) == ':') {
   196                                 ++ind ;
   196                                 ++ind ;
   197                                 // port can be null according to RFC2396
   197                                 // port can be null according to RFC2396
   198                                 if (nhost.length() > (ind + 1)) {
   198                                 if (nhost.length() > (ind + 1)) {
   199                                     port = Integer.parseInt(nhost.substring(ind+1));
   199                                     port = Integer.parseInt(nhost, ind + 1,
       
   200                                         nhost.length(), 10);
   200                                 }
   201                                 }
   201                             } else {
   202                             } else {
   202                                 throw new IllegalArgumentException(
   203                                 throw new IllegalArgumentException(
   203                                     "Invalid authority field: " + authority);
   204                                     "Invalid authority field: " + authority);
   204                             }
   205                             }
   211                     ind = host.indexOf(':');
   212                     ind = host.indexOf(':');
   212                     port = -1;
   213                     port = -1;
   213                     if (ind >= 0) {
   214                     if (ind >= 0) {
   214                         // port can be null according to RFC2396
   215                         // port can be null according to RFC2396
   215                         if (host.length() > (ind + 1)) {
   216                         if (host.length() > (ind + 1)) {
   216                             port = Integer.parseInt(host.substring(ind + 1));
   217                             port = Integer.parseInt(host, ind + 1,
       
   218                                     host.length(), 10);
   217                         }
   219                         }
   218                         host = host.substring(0, ind);
   220                         host = host.substring(0, ind);
   219                     }
   221                     }
   220                 }
   222                 }
   221             } else {
   223             } else {