src/java.base/share/classes/java/net/HostPortrange.java
changeset 52902 e3398b2e1ab0
parent 52700 b206bdfb9fe2
equal deleted inserted replaced
52901:3ba9ff4d4aaf 52902:e3398b2e1ab0
   239     }
   239     }
   240 
   240 
   241     int[] parsePort(String port)
   241     int[] parsePort(String port)
   242     {
   242     {
   243 
   243 
   244         if (port == null || port.equals("")) {
   244         if (port == null || port.isEmpty()) {
   245             return defaultPort();
   245             return defaultPort();
   246         }
   246         }
   247 
   247 
   248         if (port.equals("*")) {
   248         if (port.equals("*")) {
   249             return new int[] {PORT_MIN, PORT_MAX};
   249             return new int[] {PORT_MIN, PORT_MAX};
   258             } else {
   258             } else {
   259                 String low = port.substring(0, dash);
   259                 String low = port.substring(0, dash);
   260                 String high = port.substring(dash+1);
   260                 String high = port.substring(dash+1);
   261                 int l,h;
   261                 int l,h;
   262 
   262 
   263                 if (low.equals("")) {
   263                 if (low.isEmpty()) {
   264                     l = PORT_MIN;
   264                     l = PORT_MIN;
   265                 } else {
   265                 } else {
   266                     l = Integer.parseInt(low);
   266                     l = Integer.parseInt(low);
   267                 }
   267                 }
   268 
   268 
   269                 if (high.equals("")) {
   269                 if (high.isEmpty()) {
   270                     h = PORT_MAX;
   270                     h = PORT_MAX;
   271                 } else {
   271                 } else {
   272                     h = Integer.parseInt(high);
   272                     h = Integer.parseInt(high);
   273                 }
   273                 }
   274                 if (l < 0 || h < 0 || h<l) {
   274                 if (l < 0 || h < 0 || h<l) {