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