< 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,85 **** // 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) { try { out = new PrintStream(logfile); } catch (IOException ignore) { } } } --- 75,85 ---- // check if debugging is enabled PrintStream out = null; String logfile = props.getProperty("com.sun.sdp.debug"); if (logfile != null) { out = System.out; ! if (!logfile.isEmpty()) { try { out = new PrintStream(logfile); } catch (IOException ignore) { } } }
*** 165,177 **** 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 = "*"; String high = s.substring(pos+1); ! if (high.length() == 0) high = "*"; result[0] = low.equals("*") ? 0 : Integer.parseInt(low); result[1] = high.equals("*") ? MAX_PORT : Integer.parseInt(high); } return result; } catch (NumberFormatException e) { --- 165,177 ---- 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.isEmpty()) low = "*"; String high = s.substring(pos+1); ! 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,207 **** 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) == '#') continue; // must have 3 fields String[] s = line.split("\\s+"); if (s.length != 3) { --- 197,207 ---- List<Rule> result = new ArrayList<>(); while (scanner.hasNextLine()) { String line = scanner.nextLine().trim(); // skip blank lines and comments ! if (line.isEmpty() || line.charAt(0) == '#') continue; // must have 3 fields String[] s = line.split("\\s+"); if (s.length != 3) {
< prev index next >