< prev index next >
src/java.base/unix/classes/sun/net/sdp/SdpProvider.java
Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD
@@ -75,11 +75,11 @@
// check if debugging is enabled
PrintStream out = null;
String logfile = props.getProperty("com.sun.sdp.debug");
if (logfile != null) {
out = System.out;
- if (logfile.length() > 0) {
+ if (!logfile.isEmpty()) {
try {
out = new PrintStream(logfile);
} catch (IOException ignore) { }
}
}
@@ -165,13 +165,13 @@
boolean all = s.equals("*");
result[0] = all ? 0 : Integer.parseInt(s);
result[1] = all ? MAX_PORT : result[0];
} else {
String low = s.substring(0, pos);
- if (low.length() == 0) low = "*";
+ if (low.isEmpty()) low = "*";
String high = s.substring(pos+1);
- if (high.length() == 0) high = "*";
+ if (high.isEmpty()) high = "*";
result[0] = low.equals("*") ? 0 : Integer.parseInt(low);
result[1] = high.equals("*") ? MAX_PORT : Integer.parseInt(high);
}
return result;
} catch (NumberFormatException e) {
@@ -197,11 +197,11 @@
List<Rule> result = new ArrayList<>();
while (scanner.hasNextLine()) {
String line = scanner.nextLine().trim();
// skip blank lines and comments
- if (line.length() == 0 || line.charAt(0) == '#')
+ if (line.isEmpty() || line.charAt(0) == '#')
continue;
// must have 3 fields
String[] s = line.split("\\s+");
if (s.length != 3) {
< prev index next >