8214971: Replace use of string.equals("") with isEmpty()

Reviewed-by: jlaskey, prappo, lancea, dfuchs, redestad
This commit is contained in:
Roger Riggs 2018-12-07 11:51:17 -05:00
parent df5b42f33b
commit 938b844088
95 changed files with 195 additions and 195 deletions

View File

@ -1366,7 +1366,7 @@ class ConstantPool {
} }
if (tag == CONSTANT_Utf8) { if (tag == CONSTANT_Utf8) {
// Special case: First Utf8 must always be empty string. // Special case: First Utf8 must always be empty string.
assert(cpMap.length == 0 || cpMap[0].stringValue().equals("")); assert(cpMap.length == 0 || cpMap[0].stringValue().isEmpty());
} }
indexByTag[tag] = ix; indexByTag[tag] = ix;
// decache indexes derived from this one: // decache indexes derived from this one:

View File

@ -208,7 +208,7 @@ class Driver {
} }
} }
if (logFile != null && !logFile.equals("")) { if (logFile != null && !logFile.isEmpty()) {
if (logFile.equals("-")) { if (logFile.equals("-")) {
System.setErr(System.out); System.setErr(System.out);
} else { } else {
@ -246,7 +246,7 @@ class Driver {
} }
newfile = packfile; newfile = packfile;
// The optional second argument is the source JAR file. // The optional second argument is the source JAR file.
if (jarfile.equals("")) { if (jarfile.isEmpty()) {
// If only one file is given, it is the only JAR. // If only one file is given, it is the only JAR.
// It serves as both input and output. // It serves as both input and output.
jarfile = newfile; jarfile = newfile;
@ -352,7 +352,7 @@ class Driver {
if (Utils.isGZIPMagic(Utils.readMagic(inBuf))) { if (Utils.isGZIPMagic(Utils.readMagic(inBuf))) {
in = new GZIPInputStream(in); in = new GZIPInputStream(in);
} }
String outfile = newfile.equals("")? jarfile: newfile; String outfile = newfile.isEmpty()? jarfile: newfile;
OutputStream fileOut; OutputStream fileOut;
if (outfile.equals("-")) if (outfile.equals("-"))
fileOut = System.out; fileOut = System.out;
@ -366,7 +366,7 @@ class Driver {
// At this point, we have a good jarfile (or newfile, if -r) // At this point, we have a good jarfile (or newfile, if -r)
} }
if (!bakfile.equals("")) { if (!bakfile.isEmpty()) {
// On success, abort jarfile recovery bracket. // On success, abort jarfile recovery bracket.
new File(bakfile).delete(); new File(bakfile).delete();
bakfile = ""; bakfile = "";
@ -374,13 +374,13 @@ class Driver {
} finally { } finally {
// Close jarfile recovery bracket. // Close jarfile recovery bracket.
if (!bakfile.equals("")) { if (!bakfile.isEmpty()) {
File jarFile = new File(jarfile); File jarFile = new File(jarfile);
jarFile.delete(); // Win32 requires this, see above jarFile.delete(); // Win32 requires this, see above
new File(bakfile).renameTo(jarFile); new File(bakfile).renameTo(jarFile);
} }
// In all cases, delete temporary *.pack. // In all cases, delete temporary *.pack.
if (!tmpfile.equals("")) if (!tmpfile.isEmpty())
new File(tmpfile).delete(); new File(tmpfile).delete();
} }
} }

View File

@ -685,7 +685,7 @@ class Package {
return; // do not choose yet return; // do not choose yet
} }
String canonName = canonicalFileName(); String canonName = canonicalFileName();
if (file.nameString.equals("")) { if (file.nameString.isEmpty()) {
file.nameString = canonName; file.nameString = canonName;
} }
if (file.nameString.equals(canonName)) { if (file.nameString.equals(canonName)) {
@ -706,7 +706,7 @@ class Package {
public java.io.File getFileName(java.io.File parent) { public java.io.File getFileName(java.io.File parent) {
String name = file.name.stringValue(); String name = file.name.stringValue();
if (name.equals("")) if (name.isEmpty())
name = canonicalFileName(); name = canonicalFileName();
String fname = name.replace('/', java.io.File.separatorChar); String fname = name.replace('/', java.io.File.separatorChar);
return new java.io.File(parent, fname); return new java.io.File(parent, fname);
@ -779,7 +779,7 @@ class Package {
} }
public boolean isTrivialClassStub() { public boolean isTrivialClassStub() {
return isClassStub() return isClassStub()
&& name.stringValue().equals("") && name.stringValue().isEmpty()
&& (modtime == NO_MODTIME || modtime == default_modtime) && (modtime == NO_MODTIME || modtime == default_modtime)
&& (options &~ FO_IS_CLASS_STUB) == 0; && (options &~ FO_IS_CLASS_STUB) == 0;
} }

View File

@ -646,7 +646,7 @@ class PackageWriter extends BandStructure {
return; // nothing to write return; // nothing to write
// The first element must always be the empty string. // The first element must always be the empty string.
assert(cpMap[0].stringValue().equals("")); assert(cpMap[0].stringValue().isEmpty());
final int SUFFIX_SKIP_1 = 1; final int SUFFIX_SKIP_1 = 1;
final int PREFIX_SKIP_2 = 2; final int PREFIX_SKIP_2 = 2;

View File

@ -237,7 +237,7 @@ public class PackerImpl extends TLGlobals implements Pack200.Packer {
final long segmentLimit; final long segmentLimit;
{ {
long limit; long limit;
if (props.getProperty(Pack200.Packer.SEGMENT_LIMIT, "").equals("")) if (props.getProperty(Pack200.Packer.SEGMENT_LIMIT, "").isEmpty())
limit = -1; limit = -1;
else else
limit = props.getLong(Pack200.Packer.SEGMENT_LIMIT); limit = props.getLong(Pack200.Packer.SEGMENT_LIMIT);

View File

@ -257,7 +257,7 @@ public class File
*/ */
private File(String child, File parent) { private File(String child, File parent) {
assert parent.path != null; assert parent.path != null;
assert (!parent.path.equals("")); assert (!parent.path.isEmpty());
this.path = fs.resolve(parent.path, child); this.path = fs.resolve(parent.path, child);
this.prefixLength = parent.prefixLength; this.prefixLength = parent.prefixLength;
} }
@ -316,7 +316,7 @@ public class File
throw new NullPointerException(); throw new NullPointerException();
} }
if (parent != null) { if (parent != null) {
if (parent.equals("")) { if (parent.isEmpty()) {
this.path = fs.resolve(fs.getDefaultParent(), this.path = fs.resolve(fs.getDefaultParent(),
fs.normalize(child)); fs.normalize(child));
} else { } else {
@ -359,7 +359,7 @@ public class File
throw new NullPointerException(); throw new NullPointerException();
} }
if (parent != null) { if (parent != null) {
if (parent.path.equals("")) { if (parent.path.isEmpty()) {
this.path = fs.resolve(fs.getDefaultParent(), this.path = fs.resolve(fs.getDefaultParent(),
fs.normalize(child)); fs.normalize(child));
} else { } else {
@ -426,7 +426,7 @@ public class File
if (uri.getRawQuery() != null) if (uri.getRawQuery() != null)
throw new IllegalArgumentException("URI has a query component"); throw new IllegalArgumentException("URI has a query component");
String p = uri.getPath(); String p = uri.getPath();
if (p.equals("")) if (p.isEmpty())
throw new IllegalArgumentException("URI path component is empty"); throw new IllegalArgumentException("URI path component is empty");
// Okay, now initialize // Okay, now initialize

View File

@ -1201,7 +1201,7 @@ public class SecurityManager {
private static String[] getPackages(String p) { private static String[] getPackages(String p) {
String packages[] = null; String packages[] = null;
if (p != null && !p.equals("")) { if (p != null && !p.isEmpty()) {
java.util.StringTokenizer tok = java.util.StringTokenizer tok =
new java.util.StringTokenizer(p, ","); new java.util.StringTokenizer(p, ",");
int n = tok.countTokens(); int n = tok.countTokens();

View File

@ -970,7 +970,7 @@ public final class System {
if (key == null) { if (key == null) {
throw new NullPointerException("key can't be null"); throw new NullPointerException("key can't be null");
} }
if (key.equals("")) { if (key.isEmpty()) {
throw new IllegalArgumentException("key can't be empty"); throw new IllegalArgumentException("key can't be empty");
} }
} }

View File

@ -174,9 +174,9 @@ public final class Parameter implements AnnotatedElement {
*/ */
public String getName() { public String getName() {
// Note: empty strings as parameter names are now outlawed. // Note: empty strings as parameter names are now outlawed.
// The .equals("") is for compatibility with current JVM // The .isEmpty() is for compatibility with current JVM
// behavior. It may be removed at some point. // behavior. It may be removed at some point.
if(name == null || name.equals("")) if(name == null || name.isEmpty())
return "arg" + index; return "arg" + index;
else else
return name; return name;

View File

@ -241,7 +241,7 @@ class HostPortrange {
int[] parsePort(String port) int[] parsePort(String port)
{ {
if (port == null || port.equals("")) { if (port == null || port.isEmpty()) {
return defaultPort(); return defaultPort();
} }
@ -260,13 +260,13 @@ class HostPortrange {
String high = port.substring(dash+1); String high = port.substring(dash+1);
int l,h; int l,h;
if (low.equals("")) { if (low.isEmpty()) {
l = PORT_MIN; l = PORT_MIN;
} else { } else {
l = Integer.parseInt(low); l = Integer.parseInt(low);
} }
if (high.equals("")) { if (high.isEmpty()) {
h = PORT_MAX; h = PORT_MAX;
} else { } else {
h = Integer.parseInt(high); h = Integer.parseInt(high);

View File

@ -1009,7 +1009,7 @@ class InetAddress implements java.io.Serializable {
+ " not found "); + " not found ");
} }
if ((host == null) || (host.equals("")) || (host.equals(" "))) { if ((host == null) || (host.isEmpty()) || (host.equals(" "))) {
throw new UnknownHostException("Requested address " throw new UnknownHostException("Requested address "
+ addrString + addrString
+ " resolves to an invalid entry in hosts file " + " resolves to an invalid entry in hosts file "
@ -1046,7 +1046,7 @@ class InetAddress implements java.io.Serializable {
hostEntry = removeComments(hostEntry); hostEntry = removeComments(hostEntry);
if (hostEntry.contains(host)) { if (hostEntry.contains(host)) {
addrStr = extractHostAddr(hostEntry, host); addrStr = extractHostAddr(hostEntry, host);
if ((addrStr != null) && (!addrStr.equals(""))) { if ((addrStr != null) && (!addrStr.isEmpty())) {
addr = createAddressByteArray(addrStr); addr = createAddressByteArray(addrStr);
if (inetAddresses == null) { if (inetAddresses == null) {
inetAddresses = new ArrayList<>(1); inetAddresses = new ArrayList<>(1);

View File

@ -305,7 +305,7 @@ public final class SocketPermission extends Permission
} }
private static String getHost(String host) { private static String getHost(String host) {
if (host.equals("")) { if (host.isEmpty()) {
return "localhost"; return "localhost";
} else { } else {
/* IPv6 literal address used in this context should follow /* IPv6 literal address used in this context should follow
@ -344,7 +344,7 @@ public final class SocketPermission extends Permission
throws Exception throws Exception
{ {
if (port == null || port.equals("") || port.equals("*")) { if (port == null || port.isEmpty() || port.equals("*")) {
return new int[] {PORT_MIN, PORT_MAX}; return new int[] {PORT_MIN, PORT_MAX};
} }
@ -358,13 +358,13 @@ public final class SocketPermission extends Permission
String high = port.substring(dash+1); String high = port.substring(dash+1);
int l,h; int l,h;
if (low.equals("")) { if (low.isEmpty()) {
l = PORT_MIN; l = PORT_MIN;
} else { } else {
l = Integer.parseInt(low); l = Integer.parseInt(low);
} }
if (high.equals("")) { if (high.isEmpty()) {
h = PORT_MAX; h = PORT_MAX;
} else { } else {
h = Integer.parseInt(high); h = Integer.parseInt(high);
@ -496,7 +496,7 @@ public final class SocketPermission extends Permission
throw new NullPointerException("action can't be null"); throw new NullPointerException("action can't be null");
} }
if (action.equals("")) { if (action.isEmpty()) {
throw new IllegalArgumentException("action can't be empty"); throw new IllegalArgumentException("action can't be empty");
} }

View File

@ -533,11 +533,11 @@ public final class URLPermission extends Permission {
String thishost = this.p.hostname(); String thishost = this.p.hostname();
String thathost = that.p.hostname(); String thathost = that.p.hostname();
if (p.wildcard() && thishost.equals("")) { if (p.wildcard() && thishost.isEmpty()) {
// this "*" implies all others // this "*" implies all others
return true; return true;
} }
if (that.p.wildcard() && thathost.equals("")) { if (that.p.wildcard() && thathost.isEmpty()) {
// that "*" can only be implied by this "*" // that "*" can only be implied by this "*"
return false; return false;
} }

View File

@ -437,7 +437,7 @@ public abstract class URLStreamHandler {
return u.hostAddress; return u.hostAddress;
String host = u.getHost(); String host = u.getHost();
if (host == null || host.equals("")) { if (host == null || host.isEmpty()) {
return null; return null;
} else { } else {
try { try {

View File

@ -2226,10 +2226,10 @@ public final class Locale implements Cloneable, Serializable {
default: default:
return Arrays.stream(stringList).reduce("", return Arrays.stream(stringList).reduce("",
(s1, s2) -> { (s1, s2) -> {
if (s1.equals("")) { if (s1.isEmpty()) {
return s2; return s2;
} }
if (s2.equals("")) { if (s2.isEmpty()) {
return s1; return s1;
} }
return MessageFormat.format(pattern, s1, s2); return MessageFormat.format(pattern, s1, s2);
@ -3069,7 +3069,7 @@ public final class Locale implements Cloneable, Serializable {
private static boolean isSubtagIllFormed(String subtag, private static boolean isSubtagIllFormed(String subtag,
boolean isFirstSubtag) { boolean isFirstSubtag) {
if (subtag.equals("") || subtag.length() > 8) { if (subtag.isEmpty() || subtag.length() > 8) {
return true; return true;
} else if (subtag.equals("*")) { } else if (subtag.equals("*")) {
return false; return false;

View File

@ -704,7 +704,7 @@ public abstract class Pack200 {
if (impl == null) { if (impl == null) {
// The first time, we must decide which class to use. // The first time, we must decide which class to use.
implName = GetPropertyAction.privilegedGetProperty(prop,""); implName = GetPropertyAction.privilegedGetProperty(prop,"");
if (implName != null && !implName.equals("")) if (implName != null && !implName.isEmpty())
impl = Class.forName(implName); impl = Class.forName(implName);
else if (PACK_PROVIDER.equals(prop)) else if (PACK_PROVIDER.equals(prop))
impl = com.sun.java.util.jar.pack.PackerImpl.class; impl = com.sun.java.util.jar.pack.PackerImpl.class;

View File

@ -1290,7 +1290,7 @@ public final class Pattern
// Construct result // Construct result
int resultSize = matchList.size(); int resultSize = matchList.size();
if (limit == 0) if (limit == 0)
while (resultSize > 0 && matchList.get(resultSize-1).equals("")) while (resultSize > 0 && matchList.get(resultSize-1).isEmpty())
resultSize--; resultSize--;
String[] result = new String[resultSize]; String[] result = new String[resultSize];
return matchList.subList(0, resultSize).toArray(result); return matchList.subList(0, resultSize).toArray(result);

View File

@ -531,7 +531,7 @@ public class Cipher {
public static final Cipher getInstance(String transformation) public static final Cipher getInstance(String transformation)
throws NoSuchAlgorithmException, NoSuchPaddingException throws NoSuchAlgorithmException, NoSuchPaddingException
{ {
if ((transformation == null) || transformation.equals("")) { if ((transformation == null) || transformation.isEmpty()) {
throw new NoSuchAlgorithmException("Null or empty transformation"); throw new NoSuchAlgorithmException("Null or empty transformation");
} }
List<Transform> transforms = getTransforms(transformation); List<Transform> transforms = getTransforms(transformation);
@ -631,7 +631,7 @@ public class Cipher {
throws NoSuchAlgorithmException, NoSuchProviderException, throws NoSuchAlgorithmException, NoSuchProviderException,
NoSuchPaddingException NoSuchPaddingException
{ {
if ((transformation == null) || transformation.equals("")) { if ((transformation == null) || transformation.isEmpty()) {
throw new NoSuchAlgorithmException("Null or empty transformation"); throw new NoSuchAlgorithmException("Null or empty transformation");
} }
if ((provider == null) || (provider.length() == 0)) { if ((provider == null) || (provider.length() == 0)) {
@ -698,7 +698,7 @@ public class Cipher {
Provider provider) Provider provider)
throws NoSuchAlgorithmException, NoSuchPaddingException throws NoSuchAlgorithmException, NoSuchPaddingException
{ {
if ((transformation == null) || transformation.equals("")) { if ((transformation == null) || transformation.isEmpty()) {
throw new NoSuchAlgorithmException("Null or empty transformation"); throw new NoSuchAlgorithmException("Null or empty transformation");
} }
if (provider == null) { if (provider == null) {
@ -2840,4 +2840,4 @@ public class Cipher {
sb.append(", algorithm from: ").append(getProviderName()); sb.append(", algorithm from: ").append(getProviderName());
return sb.toString(); return sb.toString();
} }
} }

View File

@ -668,7 +668,7 @@ public class SSLParameters {
String[] tempProtocols = protocols.clone(); String[] tempProtocols = protocols.clone();
for (String p : tempProtocols) { for (String p : tempProtocols) {
if (p == null || p.equals("")) { if (p == null || p.isEmpty()) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"An element of protocols was null/empty"); "An element of protocols was null/empty");
} }

View File

@ -97,10 +97,10 @@ public class URLClassPath {
JAVA_VERSION = props.getProperty("java.version"); JAVA_VERSION = props.getProperty("java.version");
DEBUG = (props.getProperty("sun.misc.URLClassPath.debug") != null); DEBUG = (props.getProperty("sun.misc.URLClassPath.debug") != null);
String p = props.getProperty("sun.misc.URLClassPath.disableJarChecking"); String p = props.getProperty("sun.misc.URLClassPath.disableJarChecking");
DISABLE_JAR_CHECKING = p != null ? p.equals("true") || p.equals("") : false; DISABLE_JAR_CHECKING = p != null ? p.equals("true") || p.isEmpty() : false;
p = props.getProperty("jdk.net.URLClassPath.disableRestrictedPermissions"); p = props.getProperty("jdk.net.URLClassPath.disableRestrictedPermissions");
DISABLE_ACC_CHECKING = p != null ? p.equals("true") || p.equals("") : false; DISABLE_ACC_CHECKING = p != null ? p.equals("true") || p.isEmpty() : false;
// This property will be removed in a later release // This property will be removed in a later release
p = props.getProperty("jdk.net.URLClassPath.disableClassPathURLCheck", "true"); p = props.getProperty("jdk.net.URLClassPath.disableClassPathURLCheck", "true");

View File

@ -111,7 +111,7 @@ public class URLJarFile extends JarFile {
* 'file:' URLs can be accessible through ftp. * 'file:' URLs can be accessible through ftp.
*/ */
String host = url.getHost(); String host = url.getHost();
if (host == null || host.equals("") || host.equals("~") || if (host == null || host.isEmpty() || host.equals("~") ||
host.equalsIgnoreCase("localhost")) host.equalsIgnoreCase("localhost"))
return true; return true;
} }

View File

@ -127,7 +127,7 @@ public class Handler extends URLStreamHandler {
* Let's just make sure we DO have an Email address in the URL. * Let's just make sure we DO have an Email address in the URL.
*/ */
boolean nogood = false; boolean nogood = false;
if (file == null || file.equals("")) if (file == null || file.isEmpty())
nogood = true; nogood = true;
else { else {
boolean allwhites = true; boolean allwhites = true;

View File

@ -1608,7 +1608,7 @@ public class PolicyFile extends java.security.Policy {
if (u.getProtocol().equals("file")) { if (u.getProtocol().equals("file")) {
boolean isLocalFile = false; boolean isLocalFile = false;
String host = u.getHost(); String host = u.getHost();
isLocalFile = (host == null || host.equals("") || isLocalFile = (host == null || host.isEmpty() ||
host.equals("~") || host.equalsIgnoreCase("localhost")); host.equals("~") || host.equalsIgnoreCase("localhost"));
if (isLocalFile) { if (isLocalFile) {

View File

@ -103,7 +103,7 @@ public class ConsoleCallbackHandler implements CallbackHandler {
System.err.flush(); System.err.flush();
String result = readLine(); String result = readLine();
if (result.equals("")) { if (result.isEmpty()) {
result = nc.getDefaultName(); result = nc.getDefaultName();
} }
@ -212,7 +212,7 @@ public class ConsoleCallbackHandler implements CallbackHandler {
prompt = ""; prompt = "";
} }
prompt = prefix + prompt; prompt = prefix + prompt;
if (!prompt.equals("")) { if (!prompt.isEmpty()) {
System.err.println(prompt); System.err.println(prompt);
} }

View File

@ -363,7 +363,7 @@ class DomainName {
} }
private static int numLabels(String rule) { private static int numLabels(String rule) {
if (rule.equals("")) { if (rule.isEmpty()) {
return 0; return 0;
} }
int len = rule.length(); int len = rule.length();

View File

@ -103,7 +103,7 @@ class UnixFileSystem extends FileSystem {
} }
public String resolve(String parent, String child) { public String resolve(String parent, String child) {
if (child.equals("")) return parent; if (child.isEmpty()) return parent;
if (child.charAt(0) == '/') { if (child.charAt(0) == '/') {
if (parent.equals("/")) return child; if (parent.equals("/")) return child;
return parent + child; return parent + child;

View File

@ -75,7 +75,7 @@ public class Handler extends URLStreamHandler {
public synchronized URLConnection openConnection(URL u, Proxy p) public synchronized URLConnection openConnection(URL u, Proxy p)
throws IOException { throws IOException {
String host = u.getHost(); String host = u.getHost();
if (host == null || host.equals("") || host.equals("~") || if (host == null || host.isEmpty() || host.equals("~") ||
host.equalsIgnoreCase("localhost")) { host.equalsIgnoreCase("localhost")) {
File file = new File(ParseUtil.decode(u.getPath())); File file = new File(ParseUtil.decode(u.getPath()));
return createFileURLConnection(u, file); return createFileURLConnection(u, file);

View File

@ -55,7 +55,7 @@ public class FileURLMapper {
return file; return file;
} }
String host = url.getHost(); String host = url.getHost();
if (host != null && !host.equals("") && if (host != null && !host.isEmpty() &&
!"localhost".equalsIgnoreCase(host)) { !"localhost".equalsIgnoreCase(host)) {
String rest = url.getFile(); String rest = url.getFile();
String s = host + ParseUtil.decode (url.getFile()); String s = host + ParseUtil.decode (url.getFile());

View File

@ -83,7 +83,7 @@ public class Handler extends URLStreamHandler {
path = path.replace('/', '\\'); path = path.replace('/', '\\');
path = path.replace('|', ':'); path = path.replace('|', ':');
if ((host == null) || host.equals("") || if ((host == null) || host.isEmpty() ||
host.equalsIgnoreCase("localhost") || host.equalsIgnoreCase("localhost") ||
host.equals("~")) { host.equals("~")) {
return createFileURLConnection(url, new File(path)); return createFileURLConnection(url, new File(path));

View File

@ -76,7 +76,7 @@ class JarFileFactory implements URLJarFile.URLJarFileCloseController {
// Deal with UNC pathnames specially. See 4180841 // Deal with UNC pathnames specially. See 4180841
String host = url.getHost(); String host = url.getHost();
if (host != null && !host.equals("") && if (host != null && !host.isEmpty() &&
!host.equalsIgnoreCase("localhost")) { !host.equalsIgnoreCase("localhost")) {
url = new URL("file", "", "//" + host + url.getPath()); url = new URL("file", "", "//" + host + url.getPath());

View File

@ -128,12 +128,12 @@ class WindowsUriSupport {
if (uri.getRawQuery() != null) if (uri.getRawQuery() != null)
throw new IllegalArgumentException("URI has a query component"); throw new IllegalArgumentException("URI has a query component");
String path = uri.getPath(); String path = uri.getPath();
if (path.equals("")) if (path.isEmpty())
throw new IllegalArgumentException("URI path component is empty"); throw new IllegalArgumentException("URI path component is empty");
// UNC // UNC
String auth = uri.getRawAuthority(); String auth = uri.getRawAuthority();
if (auth != null && !auth.equals("")) { if (auth != null && !auth.isEmpty()) {
String host = uri.getHost(); String host = uri.getHost();
if (host == null) if (host == null)
throw new IllegalArgumentException("URI authority component has undefined host"); throw new IllegalArgumentException("URI authority component has undefined host");

View File

@ -890,7 +890,7 @@ public class LogManager {
// Gets a node in our tree of logger nodes. // Gets a node in our tree of logger nodes.
// If necessary, create it. // If necessary, create it.
LogNode getNode(String name) { LogNode getNode(String name) {
if (name == null || name.equals("")) { if (name == null || name.isEmpty()) {
return root; return root;
} }
LogNode node = root; LogNode node = root;
@ -1486,7 +1486,7 @@ public class LogManager {
// Reset Logger level // Reset Logger level
String name = logger.getName(); String name = logger.getName();
if (name != null && name.equals("")) { if (name != null && name.isEmpty()) {
// This is the root logger. // This is the root logger.
logger.setLevel(defaultLevel); logger.setLevel(defaultLevel);
} else { } else {

View File

@ -289,7 +289,7 @@ public class RMIConnectorServer extends JMXConnectorServer {
throw new MalformedURLException(msg); throw new MalformedURLException(msg);
} }
final String urlPath = url.getURLPath(); final String urlPath = url.getURLPath();
if (!urlPath.equals("") if (!urlPath.isEmpty()
&& !urlPath.equals("/") && !urlPath.equals("/")
&& !urlPath.startsWith("/jndi/")) { && !urlPath.startsWith("/jndi/")) {
final String msg = "URL path must be empty or start with " + final String msg = "URL path must be empty or start with " +
@ -746,7 +746,7 @@ public class RMIConnectorServer extends JMXConnectorServer {
port = 0; port = 0;
} else { } else {
protocol = address.getProtocol(); protocol = address.getProtocol();
host = (address.getHost().equals("")) ? null : address.getHost(); host = (address.getHost().isEmpty()) ? null : address.getHost();
port = address.getPort(); port = address.getPort();
} }

View File

@ -114,7 +114,7 @@ public class ServerNotifForwarder {
// 6238731: set the default domain if no domain is set. // 6238731: set the default domain if no domain is set.
ObjectName nn = name; ObjectName nn = name;
if (name.getDomain() == null || name.getDomain().equals("")) { if (name.getDomain() == null || name.getDomain().isEmpty()) {
try { try {
nn = ObjectName.getInstance(mbeanServer.getDefaultDomain(), nn = ObjectName.getInstance(mbeanServer.getDefaultDomain(),
name.getKeyPropertyList()); name.getKeyPropertyList());

View File

@ -110,7 +110,7 @@ public class ImmutableDescriptor implements Descriptor {
new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER); new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER);
for (Map.Entry<String, ?> entry : fields.entrySet()) { for (Map.Entry<String, ?> entry : fields.entrySet()) {
String name = entry.getKey(); String name = entry.getKey();
if (name == null || name.equals("")) if (name == null || name.isEmpty())
throw new IllegalArgumentException("Empty or null field name"); throw new IllegalArgumentException("Empty or null field name");
if (map.containsKey(name)) if (map.containsKey(name))
throw new IllegalArgumentException("Duplicate name: " + name); throw new IllegalArgumentException("Duplicate name: " + name);
@ -166,7 +166,7 @@ public class ImmutableDescriptor implements Descriptor {
new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER); new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER);
for (int i = 0; i < fieldNames.length; i++) { for (int i = 0; i < fieldNames.length; i++) {
String name = fieldNames[i]; String name = fieldNames[i];
if (name == null || name.equals("")) if (name == null || name.isEmpty())
throw new IllegalArgumentException("Empty or null field name"); throw new IllegalArgumentException("Empty or null field name");
Object old = map.put(name, fieldValues[i]); Object old = map.put(name, fieldValues[i]);
if (old != null) { if (old != null) {
@ -333,7 +333,7 @@ public class ImmutableDescriptor implements Descriptor {
Object[] result = new Object[fieldNames.length]; Object[] result = new Object[fieldNames.length];
for (int i = 0; i < fieldNames.length; i++) { for (int i = 0; i < fieldNames.length; i++) {
String name = fieldNames[i]; String name = fieldNames[i];
if (name != null && !name.equals("")) if (name != null && !name.isEmpty())
result[i] = getFieldValue(name); result[i] = getFieldValue(name);
} }
return result; return result;
@ -543,7 +543,7 @@ public class ImmutableDescriptor implements Descriptor {
} }
private static void checkIllegalFieldName(String name) { private static void checkIllegalFieldName(String name) {
if (name == null || name.equals("")) if (name == null || name.isEmpty())
illegal("Null or empty field name"); illegal("Null or empty field name");
} }

View File

@ -256,7 +256,7 @@ public class MBeanPermission extends Permission {
if (actions == null) if (actions == null)
throw new IllegalArgumentException("MBeanPermission: " + throw new IllegalArgumentException("MBeanPermission: " +
"actions can't be null"); "actions can't be null");
if (actions.equals("")) if (actions.isEmpty())
throw new IllegalArgumentException("MBeanPermission: " + throw new IllegalArgumentException("MBeanPermission: " +
"actions can't be empty"); "actions can't be empty");
@ -279,7 +279,7 @@ public class MBeanPermission extends Permission {
throw new IllegalArgumentException("MBeanPermission name " + throw new IllegalArgumentException("MBeanPermission name " +
"cannot be null"); "cannot be null");
if (name.equals("")) if (name.isEmpty())
throw new IllegalArgumentException("MBeanPermission name " + throw new IllegalArgumentException("MBeanPermission name " +
"cannot be empty"); "cannot be empty");
@ -310,7 +310,7 @@ public class MBeanPermission extends Permission {
// //
String on = name.substring(openingBracket + 1, String on = name.substring(openingBracket + 1,
name.length() - 1); name.length() - 1);
if (on.equals("")) if (on.isEmpty())
objectName = ObjectName.WILDCARD; objectName = ObjectName.WILDCARD;
else if (on.equals("-")) else if (on.equals("-"))
objectName = null; objectName = null;
@ -359,7 +359,7 @@ public class MBeanPermission extends Permission {
if (className == null || className.equals("-")) { if (className == null || className.equals("-")) {
classNamePrefix = null; classNamePrefix = null;
classNameExactMatch = false; classNameExactMatch = false;
} else if (className.equals("") || className.equals("*")) { } else if (className.isEmpty() || className.equals("*")) {
classNamePrefix = ""; classNamePrefix = "";
classNameExactMatch = false; classNameExactMatch = false;
} else if (className.endsWith(".*")) { } else if (className.endsWith(".*")) {
@ -375,7 +375,7 @@ public class MBeanPermission extends Permission {
private void setMember(String member) { private void setMember(String member) {
if (member == null || member.equals("-")) if (member == null || member.equals("-"))
this.member = null; this.member = null;
else if (member.equals("")) else if (member.isEmpty())
this.member = "*"; this.member = "*";
else else
this.member = member; this.member = member;

View File

@ -443,7 +443,7 @@ public class DescriptorSupport
init(null); init(null);
for (int i=0; i < fields.length; i++) { for (int i=0; i < fields.length; i++) {
if ((fields[i] == null) || (fields[i].equals(""))) { if ((fields[i] == null) || (fields[i].isEmpty())) {
continue; continue;
} }
int eq_separator = fields[i].indexOf('='); int eq_separator = fields[i].indexOf('=');
@ -467,7 +467,7 @@ public class DescriptorSupport
fieldValue = fields[i].substring(eq_separator+1); fieldValue = fields[i].substring(eq_separator+1);
} }
if (fieldName.equals("")) { if (fieldName.isEmpty()) {
if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
MODELMBEAN_LOGGER.log(Level.TRACE, MODELMBEAN_LOGGER.log(Level.TRACE,
"Descriptor(String... fields) " + "Descriptor(String... fields) " +
@ -500,7 +500,7 @@ public class DescriptorSupport
public synchronized Object getFieldValue(String fieldName) public synchronized Object getFieldValue(String fieldName)
throws RuntimeOperationsException { throws RuntimeOperationsException {
if ((fieldName == null) || (fieldName.equals(""))) { if ((fieldName == null) || (fieldName.isEmpty())) {
if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
MODELMBEAN_LOGGER.log(Level.TRACE, MODELMBEAN_LOGGER.log(Level.TRACE,
"Illegal arguments: null field name"); "Illegal arguments: null field name");
@ -522,7 +522,7 @@ public class DescriptorSupport
throws RuntimeOperationsException { throws RuntimeOperationsException {
// field name cannot be null or empty // field name cannot be null or empty
if ((fieldName == null) || (fieldName.equals(""))) { if ((fieldName == null) || (fieldName.isEmpty())) {
if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
MODELMBEAN_LOGGER.log(Level.TRACE, MODELMBEAN_LOGGER.log(Level.TRACE,
"Illegal arguments: null or empty field name"); "Illegal arguments: null or empty field name");
@ -664,7 +664,7 @@ public class DescriptorSupport
responseFields[i++] = value; responseFields[i++] = value;
} else { } else {
for (i=0; i < fieldNames.length; i++) { for (i=0; i < fieldNames.length; i++) {
if ((fieldNames[i] == null) || (fieldNames[i].equals(""))) { if ((fieldNames[i] == null) || (fieldNames[i].isEmpty())) {
responseFields[i] = null; responseFields[i] = null;
} else { } else {
responseFields[i] = getFieldValue(fieldNames[i]); responseFields[i] = getFieldValue(fieldNames[i]);
@ -700,7 +700,7 @@ public class DescriptorSupport
} }
for (int i=0; i < fieldNames.length; i++) { for (int i=0; i < fieldNames.length; i++) {
if (( fieldNames[i] == null) || (fieldNames[i].equals(""))) { if (( fieldNames[i] == null) || (fieldNames[i].isEmpty())) {
if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) { if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
MODELMBEAN_LOGGER.log(Level.TRACE, MODELMBEAN_LOGGER.log(Level.TRACE,
"Null field name encountered at element " + i); "Null field name encountered at element " + i);
@ -733,7 +733,7 @@ public class DescriptorSupport
} }
public synchronized void removeField(String fieldName) { public synchronized void removeField(String fieldName) {
if ((fieldName == null) || (fieldName.equals(""))) { if ((fieldName == null) || (fieldName.isEmpty())) {
return; return;
} }
@ -862,7 +862,7 @@ public class DescriptorSupport
String thisDescType = (String)(getFieldValue("descriptorType")); String thisDescType = (String)(getFieldValue("descriptorType"));
if ((thisName == null) || (thisDescType == null) || if ((thisName == null) || (thisDescType == null) ||
(thisName.equals("")) || (thisDescType.equals(""))) { (thisName.isEmpty()) || (thisDescType.isEmpty())) {
return false; return false;
} }
@ -912,7 +912,7 @@ public class DescriptorSupport
private boolean validateField(String fldName, Object fldValue) { private boolean validateField(String fldName, Object fldValue) {
if ((fldName == null) || (fldName.equals(""))) if ((fldName == null) || (fldName.isEmpty()))
return false; return false;
String SfldValue = ""; String SfldValue = "";
boolean isAString = false; boolean isAString = false;
@ -931,7 +931,7 @@ public class DescriptorSupport
fldName.equalsIgnoreCase("Class")) { fldName.equalsIgnoreCase("Class")) {
if (fldValue == null || !isAString) if (fldValue == null || !isAString)
return false; return false;
if (nameOrDescriptorType && SfldValue.equals("")) if (nameOrDescriptorType && SfldValue.isEmpty())
return false; return false;
return true; return true;
} else if (fldName.equalsIgnoreCase("visibility")) { } else if (fldName.equalsIgnoreCase("visibility")) {

View File

@ -367,7 +367,7 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo {
MODELMBEAN_LOGGER.log(Level.TRACE, "Entry"); MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
} }
if ((inDescriptorType == null) || (inDescriptorType.equals(""))) { if ((inDescriptorType == null) || (inDescriptorType.isEmpty())) {
inDescriptorType = "all"; inDescriptorType = "all";
} }
@ -600,7 +600,7 @@ public class ModelMBeanInfoSupport extends MBeanInfo implements ModelMBeanInfo {
inDescriptor = new DescriptorSupport(); inDescriptor = new DescriptorSupport();
} }
if ((inDescriptorType == null) || (inDescriptorType.equals(""))) { if ((inDescriptorType == null) || (inDescriptorType.isEmpty())) {
inDescriptorType = inDescriptorType =
(String) inDescriptor.getFieldValue("descriptorType"); (String) inDescriptor.getFieldValue("descriptorType");

View File

@ -171,7 +171,7 @@ public class CompositeType extends OpenType<CompositeData> {
private static void checkForEmptyString(String[] arg, String argName) { private static void checkForEmptyString(String[] arg, String argName) {
for (int i=0; i<arg.length; i++) { for (int i=0; i<arg.length; i++) {
if (arg[i].trim().equals("")) { if (arg[i].trim().isEmpty()) {
throw new IllegalArgumentException("Argument's element "+ argName +"["+ i +"] cannot be an empty string."); throw new IllegalArgumentException("Argument's element "+ argName +"["+ i +"] cannot be an empty string.");
} }
} }

View File

@ -456,11 +456,11 @@ public class OpenMBeanAttributeInfoSupport
throw new IllegalArgumentException("OpenType cannot be null"); throw new IllegalArgumentException("OpenType cannot be null");
if (info.getName() == null || if (info.getName() == null ||
info.getName().trim().equals("")) info.getName().trim().isEmpty())
throw new IllegalArgumentException("Name cannot be null or empty"); throw new IllegalArgumentException("Name cannot be null or empty");
if (info.getDescription() == null || if (info.getDescription() == null ||
info.getDescription().trim().equals("")) info.getDescription().trim().isEmpty())
throw new IllegalArgumentException("Description cannot be null or empty"); throw new IllegalArgumentException("Description cannot be null or empty");
// Check and initialize defaultValue // Check and initialize defaultValue

View File

@ -124,11 +124,11 @@ public class OpenMBeanConstructorInfoSupport
// check parameters that should not be null or empty // check parameters that should not be null or empty
// (unfortunately it is not done in superclass :-( ! ) // (unfortunately it is not done in superclass :-( ! )
// //
if (name == null || name.trim().equals("")) { if (name == null || name.trim().isEmpty()) {
throw new IllegalArgumentException("Argument name cannot be " + throw new IllegalArgumentException("Argument name cannot be " +
"null or empty"); "null or empty");
} }
if (description == null || description.trim().equals("")) { if (description == null || description.trim().isEmpty()) {
throw new IllegalArgumentException("Argument description cannot " + throw new IllegalArgumentException("Argument description cannot " +
"be null or empty"); "be null or empty");
} }

View File

@ -163,11 +163,11 @@ public class OpenMBeanOperationInfoSupport
// check parameters that should not be null or empty // check parameters that should not be null or empty
// (unfortunately it is not done in superclass :-( ! ) // (unfortunately it is not done in superclass :-( ! )
// //
if (name == null || name.trim().equals("")) { if (name == null || name.trim().isEmpty()) {
throw new IllegalArgumentException("Argument name cannot " + throw new IllegalArgumentException("Argument name cannot " +
"be null or empty"); "be null or empty");
} }
if (description == null || description.trim().equals("")) { if (description == null || description.trim().isEmpty()) {
throw new IllegalArgumentException("Argument description cannot " + throw new IllegalArgumentException("Argument description cannot " +
"be null or empty"); "be null or empty");
} }

View File

@ -268,7 +268,7 @@ public abstract class OpenType<T> implements Serializable {
/* Return argValue.trim() provided argValue is neither null nor empty; /* Return argValue.trim() provided argValue is neither null nor empty;
otherwise throw IllegalArgumentException. */ otherwise throw IllegalArgumentException. */
private static String valid(String argName, String argValue) { private static String valid(String argName, String argValue) {
if (argValue == null || (argValue = argValue.trim()).equals("")) if (argValue == null || (argValue = argValue.trim()).isEmpty())
throw new IllegalArgumentException("Argument " + argName + throw new IllegalArgumentException("Argument " + argName +
" cannot be null or empty"); " cannot be null or empty");
return argValue; return argValue;

View File

@ -165,7 +165,7 @@ public class TabularType extends OpenType<TabularData> {
*/ */
private static void checkForEmptyString(String[] arg, String argName) { private static void checkForEmptyString(String[] arg, String argName) {
for (int i=0; i<arg.length; i++) { for (int i=0; i<arg.length; i++) {
if (arg[i].trim().equals("")) { if (arg[i].trim().isEmpty()) {
throw new IllegalArgumentException("Argument's element "+ argName +"["+ i +"] cannot be an empty string."); throw new IllegalArgumentException("Argument's element "+ argName +"["+ i +"] cannot be an empty string.");
} }
} }

View File

@ -405,7 +405,7 @@ public class JMXConnectorFactory {
} }
final String pkgs = (String) pkgsObject; final String pkgs = (String) pkgsObject;
if (pkgs.trim().equals("")) if (pkgs.trim().isEmpty())
return null; return null;
// pkgs may not contain an empty element // pkgs may not contain an empty element

View File

@ -663,7 +663,7 @@ public abstract class MappedMXBeanType {
continue; continue;
} }
if (rest.equals("") || if (rest.isEmpty() ||
method.getParameterTypes().length > 0 || method.getParameterTypes().length > 0 ||
type == void.class || type == void.class ||
rest.equals("Class")) { rest.equals("Class")) {

View File

@ -53,7 +53,7 @@ final class Filter {
static void encodeFilterString(BerEncoder ber, String filterStr, static void encodeFilterString(BerEncoder ber, String filterStr,
boolean isLdapv3) throws IOException, NamingException { boolean isLdapv3) throws IOException, NamingException {
if ((filterStr == null) || (filterStr.equals(""))) { if ((filterStr == null) || (filterStr.isEmpty())) {
throw new InvalidSearchFilterException("Empty filter"); throw new InvalidSearchFilterException("Empty filter");
} }
byte[] filter; byte[] filter;

View File

@ -915,7 +915,7 @@ final public class LdapCtx extends ComponentDirContext
boolean directUpdate) throws NamingException { boolean directUpdate) throws NamingException {
// Handle the empty name // Handle the empty name
if (dn.equals("")) { if (dn.isEmpty()) {
return attrs; return attrs;
} }
@ -1271,7 +1271,7 @@ final public class LdapCtx extends ComponentDirContext
int prefixLast = prefix.size() - 1; int prefixLast = prefix.size() - 1;
if (name.isEmpty() || prefix.isEmpty() || if (name.isEmpty() || prefix.isEmpty() ||
name.get(0).equals("") || prefix.get(prefixLast).equals("")) { name.get(0).isEmpty() || prefix.get(prefixLast).isEmpty()) {
return super.composeName(name, prefix); return super.composeName(name, prefix);
} }
@ -1300,9 +1300,9 @@ final public class LdapCtx extends ComponentDirContext
// used by LdapSearchEnumeration // used by LdapSearchEnumeration
private static String concatNames(String lesser, String greater) { private static String concatNames(String lesser, String greater) {
if (lesser == null || lesser.equals("")) { if (lesser == null || lesser.isEmpty()) {
return greater; return greater;
} else if (greater == null || greater.equals("")) { } else if (greater == null || greater.isEmpty()) {
return lesser; return lesser;
} else { } else {
return (lesser + "," + greater); return (lesser + "," + greater);
@ -3036,7 +3036,7 @@ final public class LdapCtx extends ComponentDirContext
} }
// extract SLAPD-style referrals from errorMessage // extract SLAPD-style referrals from errorMessage
if ((res.errorMessage != null) && (!res.errorMessage.equals(""))) { if ((res.errorMessage != null) && (!res.errorMessage.isEmpty())) {
res.referrals = extractURLs(res.errorMessage); res.referrals = extractURLs(res.errorMessage);
} else { } else {
e = new PartialResultException(msg); e = new PartialResultException(msg);

View File

@ -182,7 +182,7 @@ final class LdapReferralContext implements DirContext, LdapContext {
if (urlString == null) { if (urlString == null) {
urlName = null; urlName = null;
} else { } else {
urlName = urlString.equals("") ? new CompositeName() : urlName = urlString.isEmpty() ? new CompositeName() :
new CompositeName().add(urlString); new CompositeName().add(urlString);
} }
} }
@ -888,7 +888,7 @@ final class LdapReferralContext implements DirContext, LdapContext {
// ---------------------- Private methods --------------------- // ---------------------- Private methods ---------------------
private Name toName(String name) throws InvalidNameException { private Name toName(String name) throws InvalidNameException {
return name.equals("") ? new CompositeName() : return name.isEmpty() ? new CompositeName() :
new CompositeName().add(name); new CompositeName().add(name);
} }

View File

@ -97,13 +97,13 @@ final class LdapSearchEnumeration
// Name relative to search context // Name relative to search context
CompositeName cn = new CompositeName(); CompositeName cn = new CompositeName();
if (!relStart.equals("")) { if (!relStart.isEmpty()) {
cn.add(relStart); cn.add(relStart);
} }
// Name relative to homeCtx // Name relative to homeCtx
CompositeName rcn = new CompositeName(); CompositeName rcn = new CompositeName();
if (!relHome.equals("")) { if (!relHome.isEmpty()) {
rcn.add(relHome); rcn.add(relHome);
} }
//System.err.println("relStart: " + cn); //System.err.println("relStart: " + cn);

View File

@ -197,7 +197,7 @@ final public class LdapURL extends Uri {
// path begins with a '/' or is empty // path begins with a '/' or is empty
if (path.equals("")) { if (path.isEmpty()) {
return; return;
} }

View File

@ -115,7 +115,7 @@ final class NamingEventNotifier implements Runnable {
try { try {
Continuation cont = new Continuation(); Continuation cont = new Continuation();
cont.setError(this, info.name); cont.setError(this, info.name);
Name nm = (info.name == null || info.name.equals("")) ? Name nm = (info.name == null || info.name.isEmpty()) ?
new CompositeName() : new CompositeName().add(info.name); new CompositeName() : new CompositeName().add(info.name);
results = context.searchAux(nm, info.filter, info.controls, results = context.searchAux(nm, info.filter, info.controls,

View File

@ -243,7 +243,7 @@ public abstract class AtomicContext extends ComponentContext {
protected boolean isEmpty(String name) { protected boolean isEmpty(String name) {
return name == null || name.equals(""); return name == null || name.isEmpty();
} }
// ------ implementations of c_ and c_*_nns methods using // ------ implementations of c_ and c_*_nns methods using
@ -510,7 +510,7 @@ public abstract class AtomicContext extends ComponentContext {
*/ */
protected void a_processJunction_nns(String name, Continuation cont) protected void a_processJunction_nns(String name, Continuation cont)
throws NamingException { throws NamingException {
if (name.equals("")) { if (name.isEmpty()) {
NameNotFoundException e = new NameNotFoundException(); NameNotFoundException e = new NameNotFoundException();
cont.setErrorNNS(this, name); cont.setErrorNNS(this, name);
throw cont.fillInException(e); throw cont.fillInException(e);

View File

@ -105,7 +105,7 @@ public abstract class ComponentContext extends PartialCompositeContext {
throws NamingException { throws NamingException {
int separator; int separator;
// if no name to parse, or if we're already at boundary // if no name to parse, or if we're already at boundary
if (name.isEmpty() || name.get(0).equals("")) { if (name.isEmpty() || name.get(0).isEmpty()) {
separator = 0; separator = 0;
} else { } else {
separator = 1; separator = 1;
@ -379,7 +379,7 @@ public abstract class ComponentContext extends PartialCompositeContext {
if (tail == null || tail.isEmpty()) { if (tail == null || tail.isEmpty()) {
//System.out.println("terminal : " + head); //System.out.println("terminal : " + head);
ret = TERMINAL_COMPONENT; ret = TERMINAL_COMPONENT;
} else if (!tail.get(0).equals("")) { } else if (!tail.get(0).isEmpty()) {
// tail does not begin with "/" // tail does not begin with "/"
/* /*
if (head.isEmpty()) { if (head.isEmpty()) {
@ -468,7 +468,7 @@ public abstract class ComponentContext extends PartialCompositeContext {
void checkAndAdjustRemainingName(Name rname) throws InvalidNameException { void checkAndAdjustRemainingName(Name rname) throws InvalidNameException {
int count; int count;
if (rname != null && (count=rname.size()) > 1 && if (rname != null && (count=rname.size()) > 1 &&
rname.get(count-1).equals("")) { rname.get(count-1).isEmpty()) {
rname.remove(count-1); rname.remove(count-1);
} }
} }
@ -477,7 +477,7 @@ public abstract class ComponentContext extends PartialCompositeContext {
protected boolean isAllEmpty(Name n) { protected boolean isAllEmpty(Name n) {
int count = n.size(); int count = n.size();
for (int i =0; i < count; i++ ) { for (int i =0; i < count; i++ ) {
if (!n.get(i).equals("")) { if (!n.get(i).isEmpty()) {
return false; return false;
} }
} }

View File

@ -203,7 +203,7 @@ public class Continuation extends ResolveResult {
public void setErrorNNS(Object resObj, String remain) { public void setErrorNNS(Object resObj, String remain) {
CompositeName rname = new CompositeName(); CompositeName rname = new CompositeName();
try { try {
if (remain != null && !remain.equals("")) if (remain != null && !remain.isEmpty())
rname.add(remain); rname.add(remain);
rname.add(""); rname.add("");
@ -247,7 +247,7 @@ public class Continuation extends ResolveResult {
*/ */
public void setError(Object resObj, String remain) { public void setError(Object resObj, String remain) {
CompositeName rname = new CompositeName(); CompositeName rname = new CompositeName();
if (remain != null && !remain.equals("")) { if (remain != null && !remain.isEmpty()) {
try { try {
rname.add(remain); rname.add(remain);
} catch (InvalidNameException e) { } catch (InvalidNameException e) {
@ -375,14 +375,14 @@ public class Continuation extends ResolveResult {
public void setContinue(Object obj, String relResName, public void setContinue(Object obj, String relResName,
Context currCtx, String remain) { Context currCtx, String remain) {
CompositeName relname = new CompositeName(); CompositeName relname = new CompositeName();
if (!relResName.equals("")) { if (!relResName.isEmpty()) {
try { try {
relname.add(relResName); relname.add(relResName);
} catch (NamingException e){} } catch (NamingException e){}
} }
CompositeName rname = new CompositeName(); CompositeName rname = new CompositeName();
if (!remain.equals("")) { if (!remain.isEmpty()) {
try { try {
rname.add(remain); rname.add(remain);
} catch (NamingException e) { } catch (NamingException e) {

View File

@ -477,9 +477,9 @@ public abstract class PartialCompositeContext implements Context, Resolver {
int len = prefix.size(); int len = prefix.size();
if (!allEmpty(prefix) && !allEmpty(name)) { if (!allEmpty(prefix) && !allEmpty(name)) {
if (res.get(len - 1).equals("")) { if (res.get(len - 1).isEmpty()) {
res.remove(len - 1); res.remove(len - 1);
} else if (res.get(len).equals("")) { } else if (res.get(len).isEmpty()) {
res.remove(len); res.remove(len);
} }
} }

View File

@ -138,7 +138,7 @@ public class ContextEnumerator implements NamingEnumeration<Binding> {
// if the name is relative, we need to add it to the name of this // if the name is relative, we need to add it to the name of this
// context to keep it relative w.r.t. the root context we are // context to keep it relative w.r.t. the root context we are
// enumerating // enumerating
if(oldBinding.isRelative() && !contextName.equals("")) { if(oldBinding.isRelative() && !contextName.isEmpty()) {
NameParser parser = root.getNameParser(""); NameParser parser = root.getNameParser("");
Name newName = parser.parse(contextName); Name newName = parser.parse(contextName);
newName.add(oldBinding.getName()); newName.add(oldBinding.getName());

View File

@ -476,9 +476,9 @@ abstract public class GenericURLContext implements Context {
public String composeName(String name, String prefix) public String composeName(String name, String prefix)
throws NamingException { throws NamingException {
if (prefix.equals("")) { if (prefix.isEmpty()) {
return name; return name;
} else if (name.equals("")) { } else if (name.isEmpty()) {
return prefix; return prefix;
} else { } else {
return (prefix + "/" + name); return (prefix + "/" + name);

View File

@ -201,13 +201,13 @@ class Http1Request {
private String getPathAndQuery(URI uri) { private String getPathAndQuery(URI uri) {
String path = uri.getRawPath(); String path = uri.getRawPath();
String query = uri.getRawQuery(); String query = uri.getRawQuery();
if (path == null || path.equals("")) { if (path == null || path.isEmpty()) {
path = "/"; path = "/";
} }
if (query == null) { if (query == null) {
query = ""; query = "";
} }
if (query.equals("")) { if (query.isEmpty()) {
return Utils.encode(path); return Utils.encode(path);
} else { } else {
return Utils.encode(path + "?" + query); return Utils.encode(path + "?" + query);

View File

@ -190,7 +190,7 @@ public class HttpRequestBuilderImpl implements HttpRequest.Builder {
@Override @Override
public HttpRequest.Builder method(String method, BodyPublisher body) { public HttpRequest.Builder method(String method, BodyPublisher body) {
requireNonNull(method); requireNonNull(method);
if (method.equals("")) if (method.isEmpty())
throw newIAE("illegal method <empty string>"); throw newIAE("illegal method <empty string>");
if (method.equals("CONNECT")) if (method.equals("CONNECT"))
throw newIAE("method CONNECT is not supported"); throw newIAE("method CONNECT is not supported");
@ -205,7 +205,7 @@ public class HttpRequestBuilderImpl implements HttpRequest.Builder {
private HttpRequest.Builder method0(String method, BodyPublisher body) { private HttpRequest.Builder method0(String method, BodyPublisher body) {
assert method != null; assert method != null;
assert !method.equals(""); assert !method.isEmpty();
this.method = method; this.method = method;
this.bodyPublisher = body; this.bodyPublisher = body;
return this; return this;

View File

@ -84,7 +84,7 @@ class ResponseContent {
if (contentLength == -1) { if (contentLength == -1) {
String tc = headers.firstValue("Transfer-Encoding") String tc = headers.firstValue("Transfer-Encoding")
.orElse(""); .orElse("");
if (!tc.equals("")) { if (!tc.isEmpty()) {
if (tc.equalsIgnoreCase("chunked")) { if (tc.equalsIgnoreCase("chunked")) {
chunkedContent = true; chunkedContent = true;
} else { } else {

View File

@ -97,7 +97,7 @@ public class SSLFlowDelegate {
private static final ByteBuffer NOTHING = ByteBuffer.allocate(0); private static final ByteBuffer NOTHING = ByteBuffer.allocate(0);
private static final String monProp = Utils.getProperty("jdk.internal.httpclient.monitorFlowDelegate"); private static final String monProp = Utils.getProperty("jdk.internal.httpclient.monitorFlowDelegate");
private static final boolean isMonitored = private static final boolean isMonitored =
monProp != null && (monProp.equals("") || monProp.equalsIgnoreCase("true")); monProp != null && (monProp.isEmpty() || monProp.equalsIgnoreCase("true"));
final Executor exec; final Executor exec;
final Reader reader; final Reader reader;

View File

@ -203,7 +203,7 @@ public abstract class AbstractPreferences extends Preferences {
*/ */
protected AbstractPreferences(AbstractPreferences parent, String name) { protected AbstractPreferences(AbstractPreferences parent, String name) {
if (parent==null) { if (parent==null) {
if (!name.equals("")) if (!name.isEmpty())
throw new IllegalArgumentException("Root name '"+name+ throw new IllegalArgumentException("Root name '"+name+
"' must be \"\""); "' must be \"\"");
this.absolutePath = "/"; this.absolutePath = "/";
@ -212,7 +212,7 @@ public abstract class AbstractPreferences extends Preferences {
if (name.indexOf('/') != -1) if (name.indexOf('/') != -1)
throw new IllegalArgumentException("Name '" + name + throw new IllegalArgumentException("Name '" + name +
"' contains '/'"); "' contains '/'");
if (name.equals("")) if (name.isEmpty())
throw new IllegalArgumentException("Illegal name: empty string"); throw new IllegalArgumentException("Illegal name: empty string");
root = parent.root; root = parent.root;
@ -848,7 +848,7 @@ public abstract class AbstractPreferences extends Preferences {
synchronized(lock) { synchronized(lock) {
if (removed) if (removed)
throw new IllegalStateException("Node has been removed."); throw new IllegalStateException("Node has been removed.");
if (path.equals("")) if (path.isEmpty())
return this; return this;
if (path.equals("/")) if (path.equals("/"))
return root; return root;
@ -911,7 +911,7 @@ public abstract class AbstractPreferences extends Preferences {
throws BackingStoreException throws BackingStoreException
{ {
synchronized(lock) { synchronized(lock) {
if (path.equals("")) if (path.isEmpty())
return !removed; return !removed;
if (removed) if (removed)
throw new IllegalStateException("Node has been removed."); throw new IllegalStateException("Node has been removed.");

View File

@ -189,7 +189,7 @@ public final class ExecOptionPermission extends Permission
if (name == null) if (name == null)
throw new NullPointerException("name can't be null"); throw new NullPointerException("name can't be null");
if (name.equals("")) { if (name.isEmpty()) {
throw new IllegalArgumentException("name can't be empty"); throw new IllegalArgumentException("name can't be empty");
} }

View File

@ -199,7 +199,7 @@ public final class Naming {
Registry registry = getRegistry(parsed); Registry registry = getRegistry(parsed);
String prefix = ""; String prefix = "";
if (parsed.port > 0 || !parsed.host.equals("")) if (parsed.port > 0 || !parsed.host.isEmpty())
prefix += "//" + parsed.host; prefix += "//" + parsed.host;
if (parsed.port > 0) if (parsed.port > 0)
prefix += ":" + parsed.port; prefix += ":" + parsed.port;

View File

@ -370,7 +370,7 @@ public class ActivatableRef implements RemoteRef {
ref = null; ref = null;
String className = in.readUTF(); String className = in.readUTF();
if (className.equals("")) return; if (className.isEmpty()) return;
try { try {
Class<?> refClass = Class.forName(RemoteRef.packagePrefix + "." + Class<?> refClass = Class.forName(RemoteRef.packagePrefix + "." +

View File

@ -1857,7 +1857,7 @@ public class Activation implements Serializable {
checkPermission(perms, checkPermission(perms,
new ExecOptionPermission(option)); new ExecOptionPermission(option));
} catch (AccessControlException e) { } catch (AccessControlException e) {
if (value.equals("")) { if (value.isEmpty()) {
checkPermission(perms, checkPermission(perms,
new ExecOptionPermission("-D" + name)); new ExecOptionPermission("-D" + name));
} else { } else {
@ -2101,7 +2101,7 @@ public class Activation implements Serializable {
* Initialize method for activation exec policy. * Initialize method for activation exec policy.
*/ */
if (!execPolicyClassName.equals("none")) { if (!execPolicyClassName.equals("none")) {
if (execPolicyClassName.equals("") || if (execPolicyClassName.isEmpty() ||
execPolicyClassName.equals("default")) execPolicyClassName.equals("default"))
{ {
execPolicyClassName = DefaultExecPolicy.class.getName(); execPolicyClassName = DefaultExecPolicy.class.getName();

View File

@ -738,7 +738,7 @@ public class TCPEndpoint implements Endpoint {
} }
hostName = f.getHost(); hostName = f.getHost();
if ((hostName == null) || (hostName.equals("")) if ((hostName == null) || (hostName.isEmpty())
|| (hostName.indexOf('.') < 0 )) { || (hostName.indexOf('.') < 0 )) {
hostName = hostAddress; hostName = hostAddress;

View File

@ -114,7 +114,7 @@ public class Main {
System.setProperty(value.substring(0, eq), System.setProperty(value.substring(0, eq),
value.substring(eq + 1)); value.substring(eq + 1));
} else { } else {
if (!value.equals("")) { if (!value.isEmpty()) {
System.setProperty(value, ""); System.setProperty(value, "");
} else { } else {
// do not allow empty property name // do not allow empty property name

View File

@ -593,7 +593,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
super.setCommand(cmd); super.setCommand(cmd);
if(!buildTableName(cmd).equals("")) { if(!buildTableName(cmd).isEmpty()) {
this.setTableName(buildTableName(cmd)); this.setTableName(buildTableName(cmd));
} }
} }
@ -7069,7 +7069,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
public void setMatchColumn(String[] columnNames) throws SQLException { public void setMatchColumn(String[] columnNames) throws SQLException {
for(int j = 0; j < columnNames.length; j++) { for(int j = 0; j < columnNames.length; j++) {
if( columnNames[j] == null || columnNames[j].equals("")) { if( columnNames[j] == null || columnNames[j].isEmpty()) {
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols2").toString()); throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols2").toString());
} }
} }
@ -7124,7 +7124,7 @@ public class CachedRowSetImpl extends BaseRowSet implements RowSet, RowSetIntern
*/ */
public void setMatchColumn(String columnName) throws SQLException { public void setMatchColumn(String columnName) throws SQLException {
// validate, if col is ok to be set // validate, if col is ok to be set
if(columnName == null || (columnName= columnName.trim()).equals("") ) { if(columnName == null || (columnName= columnName.trim()).isEmpty() ) {
throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols2").toString()); throw new SQLException(resBundle.handleGetObject("cachedrowsetimpl.matchcols2").toString());
} else { } else {
// set strMatchColumn // set strMatchColumn

View File

@ -624,7 +624,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
(getDataSourceName()); (getDataSourceName());
//return ds.getConnection(getUsername(),getPassword()); //return ds.getConnection(getUsername(),getPassword());
if(getUsername() != null && !getUsername().equals("")) { if(getUsername() != null && !getUsername().isEmpty()) {
return ds.getConnection(getUsername(),getPassword()); return ds.getConnection(getUsername(),getPassword());
} else { } else {
return ds.getConnection(); return ds.getConnection();
@ -3873,7 +3873,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
public void setMatchColumn(String[] columnNames) throws SQLException { public void setMatchColumn(String[] columnNames) throws SQLException {
for(int j = 0; j < columnNames.length; j++) { for(int j = 0; j < columnNames.length; j++) {
if( columnNames[j] == null || columnNames[j].equals("")) { if( columnNames[j] == null || columnNames[j].isEmpty()) {
throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.matchcols2").toString()); throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.matchcols2").toString());
} }
} }
@ -3928,7 +3928,7 @@ public class JdbcRowSetImpl extends BaseRowSet implements JdbcRowSet, Joinable {
*/ */
public void setMatchColumn(String columnName) throws SQLException { public void setMatchColumn(String columnName) throws SQLException {
// validate, if col is ok to be set // validate, if col is ok to be set
if(columnName == null || (columnName= columnName.trim()).equals("")) { if(columnName == null || (columnName= columnName.trim()).isEmpty()) {
throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.matchcols2").toString()); throw new SQLException(resBundle.handleGetObject("jdbcrowsetimpl.matchcols2").toString());
} else { } else {
// set strMatchColumn // set strMatchColumn

View File

@ -537,7 +537,7 @@ public class WebRowSetXmlWriter implements XmlWriter, Serializable {
private void writeStringData(String s) throws java.io.IOException { private void writeStringData(String s) throws java.io.IOException {
if (s == null) { if (s == null) {
writeNull(); writeNull();
} else if (s.equals("")) { } else if (s.isEmpty()) {
writeEmptyString(); writeEmptyString();
} else { } else {

View File

@ -852,7 +852,7 @@ public abstract class BaseRowSet implements Serializable, Cloneable {
if (name == null) { if (name == null) {
dataSource = null; dataSource = null;
} else if (name.equals("")) { } else if (name.isEmpty()) {
throw new SQLException("DataSource name cannot be empty string"); throw new SQLException("DataSource name cannot be empty string");
} else { } else {
dataSource = name; dataSource = name;

View File

@ -622,7 +622,7 @@ public class DriverManager {
println("DriverManager.initialize: jdbc.drivers = " + drivers); println("DriverManager.initialize: jdbc.drivers = " + drivers);
if (drivers != null && !drivers.equals("")) { if (drivers != null && !drivers.isEmpty()) {
String[] driversList = drivers.split(":"); String[] driversList = drivers.split(":");
println("number of Drivers:" + driversList.length); println("number of Drivers:" + driversList.length);
for (String aDriver : driversList) { for (String aDriver : driversList) {

View File

@ -85,7 +85,7 @@ public class AttributeImpl extends DummyEvent implements Attribute
init(); init();
fQName = qname ; fQName = qname ;
fValue = value ; fValue = value ;
if(type != null && !type.equals("")) if(type != null && !type.isEmpty())
fAttributeType = type; fAttributeType = type;
fNonNormalizedvalue = nonNormalizedvalue; fNonNormalizedvalue = nonNormalizedvalue;

View File

@ -73,7 +73,7 @@ implements StartDocument {
this.fEncodingScheam = encoding; this.fEncodingScheam = encoding;
this.fVersion = version; this.fVersion = version;
this.fStandalone = standalone; this.fStandalone = standalone;
if (encoding != null && !encoding.equals("")) if (encoding != null && !encoding.isEmpty())
this.fEncodingSchemeSet = true; this.fEncodingSchemeSet = true;
else { else {
this.fEncodingSchemeSet = false; this.fEncodingSchemeSet = false;

View File

@ -219,7 +219,7 @@ public class XMLDOMWriterImpl implements XMLStreamWriterBase {
} }
String qualifiedName = null; String qualifiedName = null;
if(prefix.equals("")){ if(prefix.isEmpty()){
qualifiedName = localName; qualifiedName = localName;
}else{ }else{
qualifiedName = getQName(prefix,localName); qualifiedName = getQName(prefix,localName);
@ -254,7 +254,7 @@ public class XMLDOMWriterImpl implements XMLStreamWriterBase {
throw new XMLStreamException("prefix cannot be null"); throw new XMLStreamException("prefix cannot be null");
} }
String qualifiedName = null; String qualifiedName = null;
if(prefix.equals("")){ if(prefix.isEmpty()){
qualifiedName = localName; qualifiedName = localName;
}else{ }else{
@ -502,7 +502,7 @@ public class XMLDOMWriterImpl implements XMLStreamWriterBase {
String qname = null; String qname = null;
if (prefix.equals("")) { if (prefix.isEmpty()) {
qname = XMLConstants.XMLNS_ATTRIBUTE; qname = XMLConstants.XMLNS_ATTRIBUTE;
} else { } else {
qname = getQName(XMLConstants.XMLNS_ATTRIBUTE,prefix); qname = getQName(XMLConstants.XMLNS_ATTRIBUTE,prefix);
@ -669,7 +669,7 @@ public class XMLDOMWriterImpl implements XMLStreamWriterBase {
throw new XMLStreamException("Prefix cannot be null"); throw new XMLStreamException("Prefix cannot be null");
} }
if(prefix.equals("")){ if(prefix.isEmpty()){
qname = localName; qname = localName;
}else{ }else{
qname = getQName(prefix,localName); qname = getQName(prefix,localName);

View File

@ -628,8 +628,8 @@ public final class XMLStreamWriterImpl extends AbstractMap<Object, Object>
} }
if (!fIsRepairingNamespace) { if (!fIsRepairingNamespace) {
if (prefix == null || prefix.equals("")){ if (prefix == null || prefix.isEmpty()){
if (!namespaceURI.equals("")) { if (!namespaceURI.isEmpty()) {
throw new XMLStreamException("prefix cannot be null or empty"); throw new XMLStreamException("prefix cannot be null or empty");
} else { } else {
writeAttributeWithPrefix(null, localName, value); writeAttributeWithPrefix(null, localName, value);
@ -908,7 +908,7 @@ public final class XMLStreamWriterImpl extends AbstractMap<Object, Object>
} else { } else {
fWriter.write(OPEN_END_TAG); fWriter.write(OPEN_END_TAG);
if ((elem.prefix != null) && !(elem.prefix).equals("")) { if ((elem.prefix != null) && !(elem.prefix).isEmpty()) {
fWriter.write(elem.prefix); fWriter.write(elem.prefix);
fWriter.write(":"); fWriter.write(":");
} }
@ -945,7 +945,7 @@ public final class XMLStreamWriterImpl extends AbstractMap<Object, Object>
fWriter.write(OPEN_END_TAG); fWriter.write(OPEN_END_TAG);
if ((currentElement.prefix != null) && if ((currentElement.prefix != null) &&
!(currentElement.prefix).equals("")) { !(currentElement.prefix).isEmpty()) {
fWriter.write(currentElement.prefix); fWriter.write(currentElement.prefix);
fWriter.write(":"); fWriter.write(":");
} }
@ -1180,19 +1180,19 @@ public final class XMLStreamWriterImpl extends AbstractMap<Object, Object>
} }
// Verify the encoding before writing anything // Verify the encoding before writing anything
if (encoding != null && !encoding.equals("")) { if (encoding != null && !encoding.isEmpty()) {
verifyEncoding(encoding); verifyEncoding(encoding);
} }
fWriter.write("<?xml version=\""); fWriter.write("<?xml version=\"");
if ((version == null) || version.equals("")) { if ((version == null) || version.isEmpty()) {
fWriter.write(DEFAULT_XML_VERSION); fWriter.write(DEFAULT_XML_VERSION);
} else { } else {
fWriter.write(version); fWriter.write(version);
} }
if (encoding != null && !encoding.equals("")) { if (encoding != null && !encoding.isEmpty()) {
fWriter.write("\" encoding=\""); fWriter.write("\" encoding=\"");
fWriter.write(encoding); fWriter.write(encoding);
} }
@ -1584,7 +1584,7 @@ public final class XMLStreamWriterImpl extends AbstractMap<Object, Object>
attr = fAttributeCache.get(j); attr = fAttributeCache.get(j);
if ((attr.prefix != null) && (attr.uri != null)) { if ((attr.prefix != null) && (attr.uri != null)) {
if (!attr.prefix.equals("") && !attr.uri.equals("") ) { if (!attr.prefix.isEmpty() && !attr.uri.isEmpty() ) {
String tmp = fInternalNamespaceContext.getPrefix(attr.uri); String tmp = fInternalNamespaceContext.getPrefix(attr.uri);
if ((tmp == null) || (!tmp.equals(attr.prefix))) { if ((tmp == null) || (!tmp.equals(attr.prefix))) {
@ -1765,7 +1765,7 @@ public final class XMLStreamWriterImpl extends AbstractMap<Object, Object>
for(int i=0 ; i< fAttributeCache.size();i++){ for(int i=0 ; i< fAttributeCache.size();i++){
attr = fAttributeCache.get(i); attr = fAttributeCache.get(i);
if((attr.prefix != null && !attr.prefix.equals("")) || (attr.uri != null && !attr.uri.equals(""))) { if((attr.prefix != null && !attr.prefix.isEmpty()) || (attr.uri != null && !attr.uri.isEmpty())) {
correctPrefix(currentElement,attr); correctPrefix(currentElement,attr);
} }
} }
@ -1773,7 +1773,7 @@ public final class XMLStreamWriterImpl extends AbstractMap<Object, Object>
if (!isDeclared(currentElement)) { if (!isDeclared(currentElement)) {
if ((currentElement.prefix != null) && if ((currentElement.prefix != null) &&
(currentElement.uri != null)) { (currentElement.uri != null)) {
if ((!currentElement.prefix.equals("")) && (!currentElement.uri.equals(""))) { if ((!currentElement.prefix.isEmpty()) && (!currentElement.uri.isEmpty())) {
fNamespaceDecls.add(currentElement); fNamespaceDecls.add(currentElement);
} }
} }
@ -1798,7 +1798,7 @@ public final class XMLStreamWriterImpl extends AbstractMap<Object, Object>
/* If 'attr' is an attribute and it is in no namespace(which means that prefix="", uri=""), attr's /* If 'attr' is an attribute and it is in no namespace(which means that prefix="", uri=""), attr's
namespace should not be redinded. See [http://www.w3.org/TR/REC-xml-names/#defaulting]. namespace should not be redinded. See [http://www.w3.org/TR/REC-xml-names/#defaulting].
*/ */
if (attr.prefix != null && attr.prefix.equals("") && attr.uri != null && attr.uri.equals("")){ if (attr.prefix != null && attr.prefix.isEmpty() && attr.uri != null && attr.uri.isEmpty()){
repairNamespaceDecl(attr); repairNamespaceDecl(attr);
} }
} }

View File

@ -619,13 +619,13 @@ public class CatalogFeatures {
private boolean getSystemProperty(Feature cf, String sysPropertyName) { private boolean getSystemProperty(Feature cf, String sysPropertyName) {
if (cf.hasSystemProperty()) { if (cf.hasSystemProperty()) {
String value = SecuritySupport.getSystemProperty(sysPropertyName); String value = SecuritySupport.getSystemProperty(sysPropertyName);
if (value != null && !value.equals("")) { if (value != null && !value.isEmpty()) {
setProperty(cf, State.SYSTEMPROPERTY, value); setProperty(cf, State.SYSTEMPROPERTY, value);
return true; return true;
} }
value = SecuritySupport.readJAXPProperty(sysPropertyName); value = SecuritySupport.readJAXPProperty(sysPropertyName);
if (value != null && !value.equals("")) { if (value != null && !value.isEmpty()) {
setProperty(cf, State.JAXPDOTPROPERTIES, value); setProperty(cf, State.JAXPDOTPROPERTIES, value);
return true; return true;
} }

View File

@ -221,7 +221,7 @@ class Util {
*/ */
static String[] getCatalogFiles(String sysPropertyName) { static String[] getCatalogFiles(String sysPropertyName) {
String value = SecuritySupport.getJAXPSystemProperty(sysPropertyName); String value = SecuritySupport.getJAXPSystemProperty(sysPropertyName);
if (value != null && !value.equals("")) { if (value != null && !value.isEmpty()) {
return value.split(";"); return value.split(";");
} }
return null; return null;

View File

@ -383,13 +383,13 @@ public class JdkXmlFeatures {
private boolean getSystemProperty(XmlFeature feature, String sysPropertyName) { private boolean getSystemProperty(XmlFeature feature, String sysPropertyName) {
try { try {
String value = SecuritySupport.getSystemProperty(sysPropertyName); String value = SecuritySupport.getSystemProperty(sysPropertyName);
if (value != null && !value.equals("")) { if (value != null && !value.isEmpty()) {
setFeature(feature, State.SYSTEMPROPERTY, Boolean.parseBoolean(value)); setFeature(feature, State.SYSTEMPROPERTY, Boolean.parseBoolean(value));
return true; return true;
} }
value = SecuritySupport.readJAXPProperty(sysPropertyName); value = SecuritySupport.readJAXPProperty(sysPropertyName);
if (value != null && !value.equals("")) { if (value != null && !value.isEmpty()) {
setFeature(feature, State.JAXPDOTPROPERTIES, Boolean.parseBoolean(value)); setFeature(feature, State.JAXPDOTPROPERTIES, Boolean.parseBoolean(value));
return true; return true;
} }

View File

@ -1180,7 +1180,7 @@ public class Main {
String name = entry.name; String name = entry.name;
boolean isDir = entry.isDir; boolean isDir = entry.isDir;
if (name.equals("") || name.equals(".") || name.equals(zname)) { if (name.isEmpty() || name.equals(".") || name.equals(zname)) {
return; return;
} else if ((name.equals(MANIFEST_DIR) || name.equals(MANIFEST_NAME)) } else if ((name.equals(MANIFEST_DIR) || name.equals(MANIFEST_NAME))
&& !Mflag) { && !Mflag) {
@ -1886,7 +1886,7 @@ public class Main {
.map(ModuleInfoEntry::name) .map(ModuleInfoEntry::name)
.map(Main::versionFromEntryName) .map(Main::versionFromEntryName)
.collect(joining(" ")); .collect(joining(" "));
if (!releases.equals("")) if (!releases.isEmpty())
output("releases: " + releases + "\n"); output("releases: " + releases + "\n");
// Describe the operative descriptor for the specified --release, if any // Describe the operative descriptor for the specified --release, if any
@ -1955,7 +1955,7 @@ public class Main {
sb.append(md.toNameAndVersion()); sb.append(md.toNameAndVersion());
if (!uriString.equals("")) if (!uriString.isEmpty())
sb.append(" ").append(uriString); sb.append(" ").append(uriString);
if (md.isOpen()) if (md.isOpen())
sb.append(" open"); sb.append(" open");

View File

@ -420,7 +420,7 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
} else { } else {
String n = ""; String n = "";
for ( ; c != null; c = c.owner.enclClass()) { for ( ; c != null; c = c.owner.enclClass()) {
n = c.name + (n.equals("") ? "" : ".") + n; n = c.name + (n.isEmpty() ? "" : ".") + n;
} }
return n; return n;
} }

View File

@ -114,18 +114,18 @@ public class SearchIndexItem {
item.append("\"m\":\"").append(containingModule).append("\","); item.append("\"m\":\"").append(containingModule).append("\",");
} }
item.append("\"l\":\"").append(label).append("\""); item.append("\"l\":\"").append(label).append("\"");
if (!url.equals("")) { if (!url.isEmpty()) {
item.append(",\"url\":\"").append(url).append("\""); item.append(",\"url\":\"").append(url).append("\"");
} }
item.append("}"); item.append("}");
break; break;
case TYPES: case TYPES:
item.append("{"); item.append("{");
if (!containingPackage.equals("")) { if (!containingPackage.isEmpty()) {
item.append("\"p\":\"").append(containingPackage).append("\","); item.append("\"p\":\"").append(containingPackage).append("\",");
} }
item.append("\"l\":\"").append(label).append("\""); item.append("\"l\":\"").append(label).append("\"");
if (!url.equals("")) { if (!url.isEmpty()) {
item.append(",\"url\":\"").append(url).append("\""); item.append(",\"url\":\"").append(url).append("\"");
} }
item.append("}"); item.append("}");
@ -135,7 +135,7 @@ public class SearchIndexItem {
.append("\"p\":\"").append(containingPackage).append("\",") .append("\"p\":\"").append(containingPackage).append("\",")
.append("\"c\":\"").append(containingClass).append("\",") .append("\"c\":\"").append(containingClass).append("\",")
.append("\"l\":\"").append(label).append("\""); .append("\"l\":\"").append(label).append("\"");
if (!url.equals("")) { if (!url.isEmpty()) {
item.append(",\"url\":\"").append(url).append("\""); item.append(",\"url\":\"").append(url).append("\"");
} }
item.append("}"); item.append("}");
@ -144,7 +144,7 @@ public class SearchIndexItem {
item.append("{") item.append("{")
.append("\"l\":\"").append(label).append("\",") .append("\"l\":\"").append(label).append("\",")
.append("\"h\":\"").append(holder).append("\","); .append("\"h\":\"").append(holder).append("\",");
if (!description.equals("")) { if (!description.isEmpty()) {
item.append("\"d\":\"").append(description).append("\","); item.append("\"d\":\"").append(description).append("\",");
} }
item.append("\"u\":\"").append(url).append("\"") item.append("\"u\":\"").append(url).append("\"")

View File

@ -149,7 +149,7 @@ public class JMap {
throws AttachNotSupportedException, IOException, throws AttachNotSupportedException, IOException,
UnsupportedEncodingException { UnsupportedEncodingException {
String liveopt = "-all"; String liveopt = "-all";
if (options.equals("") || options.equals("all")) { if (options.isEmpty() || options.equals("all")) {
// pass // pass
} }
else if (options.equals("live")) { else if (options.equals("live")) {

View File

@ -313,9 +313,9 @@ public class ConnectDialog extends InternalDialog
if (remoteRadioButton.isSelected()) { if (remoteRadioButton.isSelected()) {
String txt = remoteTF.getText().trim(); String txt = remoteTF.getText().trim();
String userName = userNameTF.getText().trim(); String userName = userNameTF.getText().trim();
userName = userName.equals("") ? null : userName; userName = userName.isEmpty() ? null : userName;
String password = passwordTF.getText(); String password = passwordTF.getText();
password = password.equals("") ? null : password; password = password.isEmpty() ? null : password;
try { try {
if (txt.startsWith(JConsole.ROOT_URL)) { if (txt.startsWith(JConsole.ROOT_URL)) {
String url = txt; String url = txt;

View File

@ -665,7 +665,7 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel
} }
public void focusLost(FocusEvent e) { public void focusLost(FocusEvent e) {
if (promptRemoved && getText().equals("")) { if (promptRemoved && getText().isEmpty()) {
setText(prompt); setText(prompt);
setForeground(Color.gray); setForeground(Color.gray);
promptRemoved = false; promptRemoved = false;

View File

@ -265,7 +265,7 @@ public class Agent {
// return empty property set // return empty property set
private static Properties parseString(String args) { private static Properties parseString(String args) {
Properties argProps = new Properties(); Properties argProps = new Properties();
if (args != null && !args.trim().equals("")) { if (args != null && !args.trim().isEmpty()) {
for (String option : args.split(",")) { for (String option : args.split(",")) {
String s[] = option.split("=", 2); String s[] = option.split("=", 2);
String name = s[0].trim(); String name = s[0].trim();

View File

@ -537,8 +537,8 @@ public class DnsContext extends ComponentDirContext {
int prefixLast = prefixC.size() - 1; int prefixLast = prefixC.size() - 1;
// Let toolkit do the work at namespace boundaries. // Let toolkit do the work at namespace boundaries.
if (nameC.isEmpty() || nameC.get(0).equals("") || if (nameC.isEmpty() || nameC.get(0).isEmpty() ||
prefixC.isEmpty() || prefixC.get(prefixLast).equals("")) { prefixC.isEmpty() || prefixC.get(prefixLast).isEmpty()) {
return super.composeName(nameC, prefixC); return super.composeName(nameC, prefixC);
} }
@ -687,7 +687,7 @@ public class DnsContext extends ComponentDirContext {
private static CT fromAttrId(String attrId) private static CT fromAttrId(String attrId)
throws InvalidAttributeIdentifierException { throws InvalidAttributeIdentifierException {
if (attrId.equals("")) { if (attrId.isEmpty()) {
throw new InvalidAttributeIdentifierException( throw new InvalidAttributeIdentifierException(
"Attribute ID cannot be empty"); "Attribute ID cannot be empty");
} }

View File

@ -368,7 +368,7 @@ public final class DnsName implements Name {
boolean hasRootLabel() { boolean hasRootLabel() {
return (!isEmpty() && return (!isEmpty() &&
get(0).equals("")); get(0).isEmpty());
} }
/* /*
@ -442,7 +442,7 @@ public final class DnsName implements Name {
// label of the name. Those two are special cases in that for // label of the name. Those two are special cases in that for
// all other domain names, the number of labels is one greater // all other domain names, the number of labels is one greater
// than the number of dot separators. // than the number of dot separators.
if (!name.equals("") && !name.equals(".")) { if (!name.isEmpty() && !name.equals(".")) {
add(0, label.toString()); add(0, label.toString());
} }

View File

@ -89,7 +89,7 @@ public class DnsUrl extends Uri {
domain = path.startsWith("/") domain = path.startsWith("/")
? path.substring(1) ? path.substring(1)
: path; : path;
domain = domain.equals("") domain = domain.isEmpty()
? "." ? "."
: UrlUtil.decode(domain); : UrlUtil.decode(domain);

View File

@ -200,7 +200,7 @@ public class ResourceRecord {
} }
private static int nameToValue(String name, String[] names) { private static int nameToValue(String name, String[] names) {
if (name.equals("")) { if (name.isEmpty()) {
return -1; // invalid name return -1; // invalid name
} else if (name.equals("*")) { } else if (name.equals("*")) {
return QTYPE_STAR; // QTYPE_STAR == QCLASS_STAR return QTYPE_STAR; // QTYPE_STAR == QCLASS_STAR

View File

@ -124,7 +124,7 @@ class ZoneNode extends NameNode {
* name and its resource records. Returns the zone's new contents. * name and its resource records. Returns the zone's new contents.
*/ */
NameNode populate(DnsName zone, ResourceRecords rrs) { NameNode populate(DnsName zone, ResourceRecords rrs) {
// assert zone.get(0).equals(""); // zone has root label // assert zone.get(0).isEmpty(); // zone has root label
// assert (zone.size() == (depth() + 1)); // +1 due to root label // assert (zone.size() == (depth() + 1)); // +1 due to root label
NameNode newContents = new NameNode(null); NameNode newContents = new NameNode(null);

View File

@ -230,7 +230,7 @@ class ClassPath {
int i = name.lastIndexOf(File.separatorChar); int i = name.lastIndexOf(File.separatorChar);
subdir = name.substring(0, i + 1); subdir = name.substring(0, i + 1);
basename = name.substring(i + 1); basename = name.substring(i + 1);
} else if (!subdir.equals("") } else if (!subdir.isEmpty()
&& !subdir.endsWith(fileSeparatorChar)) { && !subdir.endsWith(fileSeparatorChar)) {
// zip files are picky about "foo" vs. "foo/". // zip files are picky about "foo" vs. "foo/".
// also, the getFiles caches are keyed with a trailing / // also, the getFiles caches are keyed with a trailing /

View File

@ -115,7 +115,7 @@ class Package {
} }
private String makeName(String fileName) { private String makeName(String fileName) {
return pkg.equals("") ? fileName : pkg + File.separator + fileName; return pkg.isEmpty() ? fileName : pkg + File.separator + fileName;
} }
/** /**
@ -153,7 +153,7 @@ class Package {
} }
public String toString() { public String toString() {
if (pkg.equals("")) { if (pkg.isEmpty()) {
return "unnamed package"; return "unnamed package";
} }
return "package " + pkg; return "package " + pkg;