< prev index next >

src/java.base/unix/classes/sun/net/dns/ResolverConfigurationImpl.java

Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD

*** 66,83 **** BufferedReader in = new BufferedReader(new FileReader("/etc/resolv.conf")); String line; while ((line = in.readLine()) != null) { int maxvalues = maxperkeyword; ! if (line.length() == 0) continue; if (line.charAt(0) == '#' || line.charAt(0) == ';') continue; if (!line.startsWith(keyword)) continue; String value = line.substring(keyword.length()); ! if (value.length() == 0) continue; if (value.charAt(0) != ' ' && value.charAt(0) != '\t') continue; StringTokenizer st = new StringTokenizer(value, " \t"); while (st.hasMoreTokens()) { --- 66,83 ---- BufferedReader in = new BufferedReader(new FileReader("/etc/resolv.conf")); String line; while ((line = in.readLine()) != null) { int maxvalues = maxperkeyword; ! if (line.isEmpty()) continue; if (line.charAt(0) == '#' || line.charAt(0) == ';') continue; if (!line.startsWith(keyword)) continue; String value = line.substring(keyword.length()); ! if (value.isEmpty()) continue; if (value.charAt(0) != ' ' && value.charAt(0) != '\t') continue; StringTokenizer st = new StringTokenizer(value, " \t"); while (st.hasMoreTokens()) {
*** 179,189 **** // LOCALDOMAIN has absolute priority on Solaris String localDomain = localDomain0(); ! if (localDomain != null && localDomain.length() > 0) { sl = new LinkedList<>(); sl.add(localDomain); return sl; } --- 179,189 ---- // LOCALDOMAIN has absolute priority on Solaris String localDomain = localDomain0(); ! if (localDomain != null && !localDomain.isEmpty()) { sl = new LinkedList<>(); sl.add(localDomain); return sl; }
*** 209,219 **** // no local domain so try fallback (RPC) domain or // hostName sl = new LinkedList<>(); String domain = fallbackDomain0(); ! if (domain != null && domain.length() > 0) { sl.add(domain); } return sl; } --- 209,219 ---- // no local domain so try fallback (RPC) domain or // hostName sl = new LinkedList<>(); String domain = fallbackDomain0(); ! if (domain != null && !domain.isEmpty()) { sl.add(domain); } return sl; }
< prev index next >