< prev index next >
src/java.base/share/classes/java/net/HostPortrange.java
Print this page
rev 52881 : 8214971: Replace use of string.equals("") with isEmpty()
*** 239,249 ****
}
int[] parsePort(String port)
{
! if (port == null || port.equals("")) {
return defaultPort();
}
if (port.equals("*")) {
return new int[] {PORT_MIN, PORT_MAX};
--- 239,249 ----
}
int[] parsePort(String port)
{
! if (port == null || port.isEmpty()) {
return defaultPort();
}
if (port.equals("*")) {
return new int[] {PORT_MIN, PORT_MAX};
*** 258,274 ****
} else {
String low = port.substring(0, dash);
String high = port.substring(dash+1);
int l,h;
! if (low.equals("")) {
l = PORT_MIN;
} else {
l = Integer.parseInt(low);
}
! if (high.equals("")) {
h = PORT_MAX;
} else {
h = Integer.parseInt(high);
}
if (l < 0 || h < 0 || h<l) {
--- 258,274 ----
} else {
String low = port.substring(0, dash);
String high = port.substring(dash+1);
int l,h;
! if (low.isEmpty()) {
l = PORT_MIN;
} else {
l = Integer.parseInt(low);
}
! if (high.isEmpty()) {
h = PORT_MAX;
} else {
h = Integer.parseInt(high);
}
if (l < 0 || h < 0 || h<l) {
< prev index next >