8214971: Replace use of string.equals("") with isEmpty()
Reviewed-by: jlaskey, prappo, lancea, dfuchs, redestad
--- a/src/java.base/share/classes/com/sun/java/util/jar/pack/ConstantPool.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/ConstantPool.java Fri Dec 07 11:51:17 2018 -0500
@@ -1366,7 +1366,7 @@
}
if (tag == CONSTANT_Utf8) {
// 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;
// decache indexes derived from this one:
--- a/src/java.base/share/classes/com/sun/java/util/jar/pack/Driver.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/Driver.java Fri Dec 07 11:51:17 2018 -0500
@@ -208,7 +208,7 @@
}
}
- if (logFile != null && !logFile.equals("")) {
+ if (logFile != null && !logFile.isEmpty()) {
if (logFile.equals("-")) {
System.setErr(System.out);
} else {
@@ -246,7 +246,7 @@
}
newfile = packfile;
// 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.
// It serves as both input and output.
jarfile = newfile;
@@ -352,7 +352,7 @@
if (Utils.isGZIPMagic(Utils.readMagic(inBuf))) {
in = new GZIPInputStream(in);
}
- String outfile = newfile.equals("")? jarfile: newfile;
+ String outfile = newfile.isEmpty()? jarfile: newfile;
OutputStream fileOut;
if (outfile.equals("-"))
fileOut = System.out;
@@ -366,7 +366,7 @@
// At this point, we have a good jarfile (or newfile, if -r)
}
- if (!bakfile.equals("")) {
+ if (!bakfile.isEmpty()) {
// On success, abort jarfile recovery bracket.
new File(bakfile).delete();
bakfile = "";
@@ -374,13 +374,13 @@
} finally {
// Close jarfile recovery bracket.
- if (!bakfile.equals("")) {
+ if (!bakfile.isEmpty()) {
File jarFile = new File(jarfile);
jarFile.delete(); // Win32 requires this, see above
new File(bakfile).renameTo(jarFile);
}
// In all cases, delete temporary *.pack.
- if (!tmpfile.equals(""))
+ if (!tmpfile.isEmpty())
new File(tmpfile).delete();
}
}
--- a/src/java.base/share/classes/com/sun/java/util/jar/pack/Package.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/Package.java Fri Dec 07 11:51:17 2018 -0500
@@ -685,7 +685,7 @@
return; // do not choose yet
}
String canonName = canonicalFileName();
- if (file.nameString.equals("")) {
+ if (file.nameString.isEmpty()) {
file.nameString = canonName;
}
if (file.nameString.equals(canonName)) {
@@ -706,7 +706,7 @@
public java.io.File getFileName(java.io.File parent) {
String name = file.name.stringValue();
- if (name.equals(""))
+ if (name.isEmpty())
name = canonicalFileName();
String fname = name.replace('/', java.io.File.separatorChar);
return new java.io.File(parent, fname);
@@ -779,7 +779,7 @@
}
public boolean isTrivialClassStub() {
return isClassStub()
- && name.stringValue().equals("")
+ && name.stringValue().isEmpty()
&& (modtime == NO_MODTIME || modtime == default_modtime)
&& (options &~ FO_IS_CLASS_STUB) == 0;
}
--- a/src/java.base/share/classes/com/sun/java/util/jar/pack/PackageWriter.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/PackageWriter.java Fri Dec 07 11:51:17 2018 -0500
@@ -646,7 +646,7 @@
return; // nothing to write
// 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 PREFIX_SKIP_2 = 2;
--- a/src/java.base/share/classes/com/sun/java/util/jar/pack/PackerImpl.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/PackerImpl.java Fri Dec 07 11:51:17 2018 -0500
@@ -237,7 +237,7 @@
final long segmentLimit;
{
long limit;
- if (props.getProperty(Pack200.Packer.SEGMENT_LIMIT, "").equals(""))
+ if (props.getProperty(Pack200.Packer.SEGMENT_LIMIT, "").isEmpty())
limit = -1;
else
limit = props.getLong(Pack200.Packer.SEGMENT_LIMIT);
--- a/src/java.base/share/classes/java/io/File.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/java/io/File.java Fri Dec 07 11:51:17 2018 -0500
@@ -257,7 +257,7 @@
*/
private File(String child, File parent) {
assert parent.path != null;
- assert (!parent.path.equals(""));
+ assert (!parent.path.isEmpty());
this.path = fs.resolve(parent.path, child);
this.prefixLength = parent.prefixLength;
}
@@ -316,7 +316,7 @@
throw new NullPointerException();
}
if (parent != null) {
- if (parent.equals("")) {
+ if (parent.isEmpty()) {
this.path = fs.resolve(fs.getDefaultParent(),
fs.normalize(child));
} else {
@@ -359,7 +359,7 @@
throw new NullPointerException();
}
if (parent != null) {
- if (parent.path.equals("")) {
+ if (parent.path.isEmpty()) {
this.path = fs.resolve(fs.getDefaultParent(),
fs.normalize(child));
} else {
@@ -426,7 +426,7 @@
if (uri.getRawQuery() != null)
throw new IllegalArgumentException("URI has a query component");
String p = uri.getPath();
- if (p.equals(""))
+ if (p.isEmpty())
throw new IllegalArgumentException("URI path component is empty");
// Okay, now initialize
--- a/src/java.base/share/classes/java/lang/SecurityManager.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/java/lang/SecurityManager.java Fri Dec 07 11:51:17 2018 -0500
@@ -1201,7 +1201,7 @@
private static String[] getPackages(String p) {
String packages[] = null;
- if (p != null && !p.equals("")) {
+ if (p != null && !p.isEmpty()) {
java.util.StringTokenizer tok =
new java.util.StringTokenizer(p, ",");
int n = tok.countTokens();
--- a/src/java.base/share/classes/java/lang/System.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/java/lang/System.java Fri Dec 07 11:51:17 2018 -0500
@@ -970,7 +970,7 @@
if (key == null) {
throw new NullPointerException("key can't be null");
}
- if (key.equals("")) {
+ if (key.isEmpty()) {
throw new IllegalArgumentException("key can't be empty");
}
}
--- a/src/java.base/share/classes/java/lang/reflect/Parameter.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/java/lang/reflect/Parameter.java Fri Dec 07 11:51:17 2018 -0500
@@ -174,9 +174,9 @@
*/
public String getName() {
// 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.
- if(name == null || name.equals(""))
+ if(name == null || name.isEmpty())
return "arg" + index;
else
return name;
--- a/src/java.base/share/classes/java/net/HostPortrange.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/java/net/HostPortrange.java Fri Dec 07 11:51:17 2018 -0500
@@ -241,7 +241,7 @@
int[] parsePort(String port)
{
- if (port == null || port.equals("")) {
+ if (port == null || port.isEmpty()) {
return defaultPort();
}
@@ -260,13 +260,13 @@
String high = port.substring(dash+1);
int l,h;
- if (low.equals("")) {
+ if (low.isEmpty()) {
l = PORT_MIN;
} else {
l = Integer.parseInt(low);
}
- if (high.equals("")) {
+ if (high.isEmpty()) {
h = PORT_MAX;
} else {
h = Integer.parseInt(high);
--- a/src/java.base/share/classes/java/net/InetAddress.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/java/net/InetAddress.java Fri Dec 07 11:51:17 2018 -0500
@@ -1009,7 +1009,7 @@
+ " not found ");
}
- if ((host == null) || (host.equals("")) || (host.equals(" "))) {
+ if ((host == null) || (host.isEmpty()) || (host.equals(" "))) {
throw new UnknownHostException("Requested address "
+ addrString
+ " resolves to an invalid entry in hosts file "
@@ -1046,7 +1046,7 @@
hostEntry = removeComments(hostEntry);
if (hostEntry.contains(host)) {
addrStr = extractHostAddr(hostEntry, host);
- if ((addrStr != null) && (!addrStr.equals(""))) {
+ if ((addrStr != null) && (!addrStr.isEmpty())) {
addr = createAddressByteArray(addrStr);
if (inetAddresses == null) {
inetAddresses = new ArrayList<>(1);
--- a/src/java.base/share/classes/java/net/SocketPermission.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/java/net/SocketPermission.java Fri Dec 07 11:51:17 2018 -0500
@@ -305,7 +305,7 @@
}
private static String getHost(String host) {
- if (host.equals("")) {
+ if (host.isEmpty()) {
return "localhost";
} else {
/* IPv6 literal address used in this context should follow
@@ -344,7 +344,7 @@
throws Exception
{
- if (port == null || port.equals("") || port.equals("*")) {
+ if (port == null || port.isEmpty() || port.equals("*")) {
return new int[] {PORT_MIN, PORT_MAX};
}
@@ -358,13 +358,13 @@
String high = port.substring(dash+1);
int l,h;
- if (low.equals("")) {
+ if (low.isEmpty()) {
l = PORT_MIN;
} else {
l = Integer.parseInt(low);
}
- if (high.equals("")) {
+ if (high.isEmpty()) {
h = PORT_MAX;
} else {
h = Integer.parseInt(high);
@@ -496,7 +496,7 @@
throw new NullPointerException("action can't be null");
}
- if (action.equals("")) {
+ if (action.isEmpty()) {
throw new IllegalArgumentException("action can't be empty");
}
--- a/src/java.base/share/classes/java/net/URLPermission.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/java/net/URLPermission.java Fri Dec 07 11:51:17 2018 -0500
@@ -533,11 +533,11 @@
String thishost = this.p.hostname();
String thathost = that.p.hostname();
- if (p.wildcard() && thishost.equals("")) {
+ if (p.wildcard() && thishost.isEmpty()) {
// this "*" implies all others
return true;
}
- if (that.p.wildcard() && thathost.equals("")) {
+ if (that.p.wildcard() && thathost.isEmpty()) {
// that "*" can only be implied by this "*"
return false;
}
--- a/src/java.base/share/classes/java/net/URLStreamHandler.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/java/net/URLStreamHandler.java Fri Dec 07 11:51:17 2018 -0500
@@ -437,7 +437,7 @@
return u.hostAddress;
String host = u.getHost();
- if (host == null || host.equals("")) {
+ if (host == null || host.isEmpty()) {
return null;
} else {
try {
--- a/src/java.base/share/classes/java/util/Locale.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/java/util/Locale.java Fri Dec 07 11:51:17 2018 -0500
@@ -2226,10 +2226,10 @@
default:
return Arrays.stream(stringList).reduce("",
(s1, s2) -> {
- if (s1.equals("")) {
+ if (s1.isEmpty()) {
return s2;
}
- if (s2.equals("")) {
+ if (s2.isEmpty()) {
return s1;
}
return MessageFormat.format(pattern, s1, s2);
@@ -3069,7 +3069,7 @@
private static boolean isSubtagIllFormed(String subtag,
boolean isFirstSubtag) {
- if (subtag.equals("") || subtag.length() > 8) {
+ if (subtag.isEmpty() || subtag.length() > 8) {
return true;
} else if (subtag.equals("*")) {
return false;
--- a/src/java.base/share/classes/java/util/jar/Pack200.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/java/util/jar/Pack200.java Fri Dec 07 11:51:17 2018 -0500
@@ -704,7 +704,7 @@
if (impl == null) {
// The first time, we must decide which class to use.
implName = GetPropertyAction.privilegedGetProperty(prop,"");
- if (implName != null && !implName.equals(""))
+ if (implName != null && !implName.isEmpty())
impl = Class.forName(implName);
else if (PACK_PROVIDER.equals(prop))
impl = com.sun.java.util.jar.pack.PackerImpl.class;
--- a/src/java.base/share/classes/java/util/regex/Pattern.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/java/util/regex/Pattern.java Fri Dec 07 11:51:17 2018 -0500
@@ -1290,7 +1290,7 @@
// Construct result
int resultSize = matchList.size();
if (limit == 0)
- while (resultSize > 0 && matchList.get(resultSize-1).equals(""))
+ while (resultSize > 0 && matchList.get(resultSize-1).isEmpty())
resultSize--;
String[] result = new String[resultSize];
return matchList.subList(0, resultSize).toArray(result);
--- a/src/java.base/share/classes/javax/crypto/Cipher.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/javax/crypto/Cipher.java Fri Dec 07 11:51:17 2018 -0500
@@ -531,7 +531,7 @@
public static final Cipher getInstance(String transformation)
throws NoSuchAlgorithmException, NoSuchPaddingException
{
- if ((transformation == null) || transformation.equals("")) {
+ if ((transformation == null) || transformation.isEmpty()) {
throw new NoSuchAlgorithmException("Null or empty transformation");
}
List<Transform> transforms = getTransforms(transformation);
@@ -631,7 +631,7 @@
throws NoSuchAlgorithmException, NoSuchProviderException,
NoSuchPaddingException
{
- if ((transformation == null) || transformation.equals("")) {
+ if ((transformation == null) || transformation.isEmpty()) {
throw new NoSuchAlgorithmException("Null or empty transformation");
}
if ((provider == null) || (provider.length() == 0)) {
@@ -698,7 +698,7 @@
Provider provider)
throws NoSuchAlgorithmException, NoSuchPaddingException
{
- if ((transformation == null) || transformation.equals("")) {
+ if ((transformation == null) || transformation.isEmpty()) {
throw new NoSuchAlgorithmException("Null or empty transformation");
}
if (provider == null) {
@@ -2840,4 +2840,4 @@
sb.append(", algorithm from: ").append(getProviderName());
return sb.toString();
}
-}
\ No newline at end of file
+}
--- a/src/java.base/share/classes/javax/net/ssl/SSLParameters.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/javax/net/ssl/SSLParameters.java Fri Dec 07 11:51:17 2018 -0500
@@ -668,7 +668,7 @@
String[] tempProtocols = protocols.clone();
for (String p : tempProtocols) {
- if (p == null || p.equals("")) {
+ if (p == null || p.isEmpty()) {
throw new IllegalArgumentException(
"An element of protocols was null/empty");
}
--- a/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java Fri Dec 07 11:51:17 2018 -0500
@@ -97,10 +97,10 @@
JAVA_VERSION = props.getProperty("java.version");
DEBUG = (props.getProperty("sun.misc.URLClassPath.debug") != null);
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");
- 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
p = props.getProperty("jdk.net.URLClassPath.disableClassPathURLCheck", "true");
--- a/src/java.base/share/classes/sun/net/www/protocol/jar/URLJarFile.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/sun/net/www/protocol/jar/URLJarFile.java Fri Dec 07 11:51:17 2018 -0500
@@ -111,7 +111,7 @@
* 'file:' URLs can be accessible through ftp.
*/
String host = url.getHost();
- if (host == null || host.equals("") || host.equals("~") ||
+ if (host == null || host.isEmpty() || host.equals("~") ||
host.equalsIgnoreCase("localhost"))
return true;
}
--- a/src/java.base/share/classes/sun/net/www/protocol/mailto/Handler.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/sun/net/www/protocol/mailto/Handler.java Fri Dec 07 11:51:17 2018 -0500
@@ -127,7 +127,7 @@
* Let's just make sure we DO have an Email address in the URL.
*/
boolean nogood = false;
- if (file == null || file.equals(""))
+ if (file == null || file.isEmpty())
nogood = true;
else {
boolean allwhites = true;
--- a/src/java.base/share/classes/sun/security/provider/PolicyFile.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/sun/security/provider/PolicyFile.java Fri Dec 07 11:51:17 2018 -0500
@@ -1608,7 +1608,7 @@
if (u.getProtocol().equals("file")) {
boolean isLocalFile = false;
String host = u.getHost();
- isLocalFile = (host == null || host.equals("") ||
+ isLocalFile = (host == null || host.isEmpty() ||
host.equals("~") || host.equalsIgnoreCase("localhost"));
if (isLocalFile) {
--- a/src/java.base/share/classes/sun/security/util/ConsoleCallbackHandler.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/sun/security/util/ConsoleCallbackHandler.java Fri Dec 07 11:51:17 2018 -0500
@@ -103,7 +103,7 @@
System.err.flush();
String result = readLine();
- if (result.equals("")) {
+ if (result.isEmpty()) {
result = nc.getDefaultName();
}
@@ -212,7 +212,7 @@
prompt = "";
}
prompt = prefix + prompt;
- if (!prompt.equals("")) {
+ if (!prompt.isEmpty()) {
System.err.println(prompt);
}
--- a/src/java.base/share/classes/sun/security/util/DomainName.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/share/classes/sun/security/util/DomainName.java Fri Dec 07 11:51:17 2018 -0500
@@ -363,7 +363,7 @@
}
private static int numLabels(String rule) {
- if (rule.equals("")) {
+ if (rule.isEmpty()) {
return 0;
}
int len = rule.length();
--- a/src/java.base/unix/classes/java/io/UnixFileSystem.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/unix/classes/java/io/UnixFileSystem.java Fri Dec 07 11:51:17 2018 -0500
@@ -103,7 +103,7 @@
}
public String resolve(String parent, String child) {
- if (child.equals("")) return parent;
+ if (child.isEmpty()) return parent;
if (child.charAt(0) == '/') {
if (parent.equals("/")) return child;
return parent + child;
--- a/src/java.base/unix/classes/sun/net/www/protocol/file/Handler.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/unix/classes/sun/net/www/protocol/file/Handler.java Fri Dec 07 11:51:17 2018 -0500
@@ -75,7 +75,7 @@
public synchronized URLConnection openConnection(URL u, Proxy p)
throws IOException {
String host = u.getHost();
- if (host == null || host.equals("") || host.equals("~") ||
+ if (host == null || host.isEmpty() || host.equals("~") ||
host.equalsIgnoreCase("localhost")) {
File file = new File(ParseUtil.decode(u.getPath()));
return createFileURLConnection(u, file);
--- a/src/java.base/windows/classes/jdk/internal/loader/FileURLMapper.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/windows/classes/jdk/internal/loader/FileURLMapper.java Fri Dec 07 11:51:17 2018 -0500
@@ -55,7 +55,7 @@
return file;
}
String host = url.getHost();
- if (host != null && !host.equals("") &&
+ if (host != null && !host.isEmpty() &&
!"localhost".equalsIgnoreCase(host)) {
String rest = url.getFile();
String s = host + ParseUtil.decode (url.getFile());
--- a/src/java.base/windows/classes/sun/net/www/protocol/file/Handler.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/windows/classes/sun/net/www/protocol/file/Handler.java Fri Dec 07 11:51:17 2018 -0500
@@ -83,7 +83,7 @@
path = path.replace('/', '\\');
path = path.replace('|', ':');
- if ((host == null) || host.equals("") ||
+ if ((host == null) || host.isEmpty() ||
host.equalsIgnoreCase("localhost") ||
host.equals("~")) {
return createFileURLConnection(url, new File(path));
--- a/src/java.base/windows/classes/sun/net/www/protocol/jar/JarFileFactory.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/windows/classes/sun/net/www/protocol/jar/JarFileFactory.java Fri Dec 07 11:51:17 2018 -0500
@@ -76,7 +76,7 @@
// Deal with UNC pathnames specially. See 4180841
String host = url.getHost();
- if (host != null && !host.equals("") &&
+ if (host != null && !host.isEmpty() &&
!host.equalsIgnoreCase("localhost")) {
url = new URL("file", "", "//" + host + url.getPath());
--- a/src/java.base/windows/classes/sun/nio/fs/WindowsUriSupport.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.base/windows/classes/sun/nio/fs/WindowsUriSupport.java Fri Dec 07 11:51:17 2018 -0500
@@ -128,12 +128,12 @@
if (uri.getRawQuery() != null)
throw new IllegalArgumentException("URI has a query component");
String path = uri.getPath();
- if (path.equals(""))
+ if (path.isEmpty())
throw new IllegalArgumentException("URI path component is empty");
// UNC
String auth = uri.getRawAuthority();
- if (auth != null && !auth.equals("")) {
+ if (auth != null && !auth.isEmpty()) {
String host = uri.getHost();
if (host == null)
throw new IllegalArgumentException("URI authority component has undefined host");
--- a/src/java.logging/share/classes/java/util/logging/LogManager.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.logging/share/classes/java/util/logging/LogManager.java Fri Dec 07 11:51:17 2018 -0500
@@ -890,7 +890,7 @@
// Gets a node in our tree of logger nodes.
// If necessary, create it.
LogNode getNode(String name) {
- if (name == null || name.equals("")) {
+ if (name == null || name.isEmpty()) {
return root;
}
LogNode node = root;
@@ -1486,7 +1486,7 @@
// Reset Logger level
String name = logger.getName();
- if (name != null && name.equals("")) {
+ if (name != null && name.isEmpty()) {
// This is the root logger.
logger.setLevel(defaultLevel);
} else {
--- a/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnectorServer.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.management.rmi/share/classes/javax/management/remote/rmi/RMIConnectorServer.java Fri Dec 07 11:51:17 2018 -0500
@@ -289,7 +289,7 @@
throw new MalformedURLException(msg);
}
final String urlPath = url.getURLPath();
- if (!urlPath.equals("")
+ if (!urlPath.isEmpty()
&& !urlPath.equals("/")
&& !urlPath.startsWith("/jndi/")) {
final String msg = "URL path must be empty or start with " +
@@ -746,7 +746,7 @@
port = 0;
} else {
protocol = address.getProtocol();
- host = (address.getHost().equals("")) ? null : address.getHost();
+ host = (address.getHost().isEmpty()) ? null : address.getHost();
port = address.getPort();
}
--- a/src/java.management/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.management/share/classes/com/sun/jmx/remote/internal/ServerNotifForwarder.java Fri Dec 07 11:51:17 2018 -0500
@@ -114,7 +114,7 @@
// 6238731: set the default domain if no domain is set.
ObjectName nn = name;
- if (name.getDomain() == null || name.getDomain().equals("")) {
+ if (name.getDomain() == null || name.getDomain().isEmpty()) {
try {
nn = ObjectName.getInstance(mbeanServer.getDefaultDomain(),
name.getKeyPropertyList());
--- a/src/java.management/share/classes/javax/management/ImmutableDescriptor.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.management/share/classes/javax/management/ImmutableDescriptor.java Fri Dec 07 11:51:17 2018 -0500
@@ -110,7 +110,7 @@
new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER);
for (Map.Entry<String, ?> entry : fields.entrySet()) {
String name = entry.getKey();
- if (name == null || name.equals(""))
+ if (name == null || name.isEmpty())
throw new IllegalArgumentException("Empty or null field name");
if (map.containsKey(name))
throw new IllegalArgumentException("Duplicate name: " + name);
@@ -166,7 +166,7 @@
new TreeMap<String, Object>(String.CASE_INSENSITIVE_ORDER);
for (int i = 0; i < fieldNames.length; i++) {
String name = fieldNames[i];
- if (name == null || name.equals(""))
+ if (name == null || name.isEmpty())
throw new IllegalArgumentException("Empty or null field name");
Object old = map.put(name, fieldValues[i]);
if (old != null) {
@@ -333,7 +333,7 @@
Object[] result = new Object[fieldNames.length];
for (int i = 0; i < fieldNames.length; i++) {
String name = fieldNames[i];
- if (name != null && !name.equals(""))
+ if (name != null && !name.isEmpty())
result[i] = getFieldValue(name);
}
return result;
@@ -543,7 +543,7 @@
}
private static void checkIllegalFieldName(String name) {
- if (name == null || name.equals(""))
+ if (name == null || name.isEmpty())
illegal("Null or empty field name");
}
--- a/src/java.management/share/classes/javax/management/MBeanPermission.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.management/share/classes/javax/management/MBeanPermission.java Fri Dec 07 11:51:17 2018 -0500
@@ -256,7 +256,7 @@
if (actions == null)
throw new IllegalArgumentException("MBeanPermission: " +
"actions can't be null");
- if (actions.equals(""))
+ if (actions.isEmpty())
throw new IllegalArgumentException("MBeanPermission: " +
"actions can't be empty");
@@ -279,7 +279,7 @@
throw new IllegalArgumentException("MBeanPermission name " +
"cannot be null");
- if (name.equals(""))
+ if (name.isEmpty())
throw new IllegalArgumentException("MBeanPermission name " +
"cannot be empty");
@@ -310,7 +310,7 @@
//
String on = name.substring(openingBracket + 1,
name.length() - 1);
- if (on.equals(""))
+ if (on.isEmpty())
objectName = ObjectName.WILDCARD;
else if (on.equals("-"))
objectName = null;
@@ -359,7 +359,7 @@
if (className == null || className.equals("-")) {
classNamePrefix = null;
classNameExactMatch = false;
- } else if (className.equals("") || className.equals("*")) {
+ } else if (className.isEmpty() || className.equals("*")) {
classNamePrefix = "";
classNameExactMatch = false;
} else if (className.endsWith(".*")) {
@@ -375,7 +375,7 @@
private void setMember(String member) {
if (member == null || member.equals("-"))
this.member = null;
- else if (member.equals(""))
+ else if (member.isEmpty())
this.member = "*";
else
this.member = member;
--- a/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.management/share/classes/javax/management/modelmbean/DescriptorSupport.java Fri Dec 07 11:51:17 2018 -0500
@@ -443,7 +443,7 @@
init(null);
for (int i=0; i < fields.length; i++) {
- if ((fields[i] == null) || (fields[i].equals(""))) {
+ if ((fields[i] == null) || (fields[i].isEmpty())) {
continue;
}
int eq_separator = fields[i].indexOf('=');
@@ -467,7 +467,7 @@
fieldValue = fields[i].substring(eq_separator+1);
}
- if (fieldName.equals("")) {
+ if (fieldName.isEmpty()) {
if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
MODELMBEAN_LOGGER.log(Level.TRACE,
"Descriptor(String... fields) " +
@@ -500,7 +500,7 @@
public synchronized Object getFieldValue(String fieldName)
throws RuntimeOperationsException {
- if ((fieldName == null) || (fieldName.equals(""))) {
+ if ((fieldName == null) || (fieldName.isEmpty())) {
if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
MODELMBEAN_LOGGER.log(Level.TRACE,
"Illegal arguments: null field name");
@@ -522,7 +522,7 @@
throws RuntimeOperationsException {
// field name cannot be null or empty
- if ((fieldName == null) || (fieldName.equals(""))) {
+ if ((fieldName == null) || (fieldName.isEmpty())) {
if (MODELMBEAN_LOGGER.isLoggable(Level.TRACE)) {
MODELMBEAN_LOGGER.log(Level.TRACE,
"Illegal arguments: null or empty field name");
@@ -664,7 +664,7 @@
responseFields[i++] = value;
} else {
for (i=0; i < fieldNames.length; i++) {
- if ((fieldNames[i] == null) || (fieldNames[i].equals(""))) {
+ if ((fieldNames[i] == null) || (fieldNames[i].isEmpty())) {
responseFields[i] = null;
} else {
responseFields[i] = getFieldValue(fieldNames[i]);
@@ -700,7 +700,7 @@
}
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)) {
MODELMBEAN_LOGGER.log(Level.TRACE,
"Null field name encountered at element " + i);
@@ -733,7 +733,7 @@
}
public synchronized void removeField(String fieldName) {
- if ((fieldName == null) || (fieldName.equals(""))) {
+ if ((fieldName == null) || (fieldName.isEmpty())) {
return;
}
@@ -862,7 +862,7 @@
String thisDescType = (String)(getFieldValue("descriptorType"));
if ((thisName == null) || (thisDescType == null) ||
- (thisName.equals("")) || (thisDescType.equals(""))) {
+ (thisName.isEmpty()) || (thisDescType.isEmpty())) {
return false;
}
@@ -912,7 +912,7 @@
private boolean validateField(String fldName, Object fldValue) {
- if ((fldName == null) || (fldName.equals("")))
+ if ((fldName == null) || (fldName.isEmpty()))
return false;
String SfldValue = "";
boolean isAString = false;
@@ -931,7 +931,7 @@
fldName.equalsIgnoreCase("Class")) {
if (fldValue == null || !isAString)
return false;
- if (nameOrDescriptorType && SfldValue.equals(""))
+ if (nameOrDescriptorType && SfldValue.isEmpty())
return false;
return true;
} else if (fldName.equalsIgnoreCase("visibility")) {
--- a/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanInfoSupport.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.management/share/classes/javax/management/modelmbean/ModelMBeanInfoSupport.java Fri Dec 07 11:51:17 2018 -0500
@@ -367,7 +367,7 @@
MODELMBEAN_LOGGER.log(Level.TRACE, "Entry");
}
- if ((inDescriptorType == null) || (inDescriptorType.equals(""))) {
+ if ((inDescriptorType == null) || (inDescriptorType.isEmpty())) {
inDescriptorType = "all";
}
@@ -600,7 +600,7 @@
inDescriptor = new DescriptorSupport();
}
- if ((inDescriptorType == null) || (inDescriptorType.equals(""))) {
+ if ((inDescriptorType == null) || (inDescriptorType.isEmpty())) {
inDescriptorType =
(String) inDescriptor.getFieldValue("descriptorType");
--- a/src/java.management/share/classes/javax/management/openmbean/CompositeType.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.management/share/classes/javax/management/openmbean/CompositeType.java Fri Dec 07 11:51:17 2018 -0500
@@ -171,7 +171,7 @@
private static void checkForEmptyString(String[] arg, String argName) {
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.");
}
}
--- a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanAttributeInfoSupport.java Fri Dec 07 11:51:17 2018 -0500
@@ -456,11 +456,11 @@
throw new IllegalArgumentException("OpenType cannot be null");
if (info.getName() == null ||
- info.getName().trim().equals(""))
+ info.getName().trim().isEmpty())
throw new IllegalArgumentException("Name cannot be null or empty");
if (info.getDescription() == null ||
- info.getDescription().trim().equals(""))
+ info.getDescription().trim().isEmpty())
throw new IllegalArgumentException("Description cannot be null or empty");
// Check and initialize defaultValue
--- a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanConstructorInfoSupport.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanConstructorInfoSupport.java Fri Dec 07 11:51:17 2018 -0500
@@ -124,11 +124,11 @@
// check parameters that should not be null or empty
// (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 " +
"null or empty");
}
- if (description == null || description.trim().equals("")) {
+ if (description == null || description.trim().isEmpty()) {
throw new IllegalArgumentException("Argument description cannot " +
"be null or empty");
}
--- a/src/java.management/share/classes/javax/management/openmbean/OpenMBeanOperationInfoSupport.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.management/share/classes/javax/management/openmbean/OpenMBeanOperationInfoSupport.java Fri Dec 07 11:51:17 2018 -0500
@@ -163,11 +163,11 @@
// check parameters that should not be null or empty
// (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 null or empty");
}
- if (description == null || description.trim().equals("")) {
+ if (description == null || description.trim().isEmpty()) {
throw new IllegalArgumentException("Argument description cannot " +
"be null or empty");
}
--- a/src/java.management/share/classes/javax/management/openmbean/OpenType.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.management/share/classes/javax/management/openmbean/OpenType.java Fri Dec 07 11:51:17 2018 -0500
@@ -268,7 +268,7 @@
/* Return argValue.trim() provided argValue is neither null nor empty;
otherwise throw IllegalArgumentException. */
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 +
" cannot be null or empty");
return argValue;
--- a/src/java.management/share/classes/javax/management/openmbean/TabularType.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.management/share/classes/javax/management/openmbean/TabularType.java Fri Dec 07 11:51:17 2018 -0500
@@ -165,7 +165,7 @@
*/
private static void checkForEmptyString(String[] arg, String argName) {
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.");
}
}
--- a/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java Fri Dec 07 11:51:17 2018 -0500
@@ -405,7 +405,7 @@
}
final String pkgs = (String) pkgsObject;
- if (pkgs.trim().equals(""))
+ if (pkgs.trim().isEmpty())
return null;
// pkgs may not contain an empty element
--- a/src/java.management/share/classes/sun/management/MappedMXBeanType.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.management/share/classes/sun/management/MappedMXBeanType.java Fri Dec 07 11:51:17 2018 -0500
@@ -663,7 +663,7 @@
continue;
}
- if (rest.equals("") ||
+ if (rest.isEmpty() ||
method.getParameterTypes().length > 0 ||
type == void.class ||
rest.equals("Class")) {
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/Filter.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/Filter.java Fri Dec 07 11:51:17 2018 -0500
@@ -53,7 +53,7 @@
static void encodeFilterString(BerEncoder ber, String filterStr,
boolean isLdapv3) throws IOException, NamingException {
- if ((filterStr == null) || (filterStr.equals(""))) {
+ if ((filterStr == null) || (filterStr.isEmpty())) {
throw new InvalidSearchFilterException("Empty filter");
}
byte[] filter;
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtx.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/LdapCtx.java Fri Dec 07 11:51:17 2018 -0500
@@ -915,7 +915,7 @@
boolean directUpdate) throws NamingException {
// Handle the empty name
- if (dn.equals("")) {
+ if (dn.isEmpty()) {
return attrs;
}
@@ -1271,7 +1271,7 @@
int prefixLast = prefix.size() - 1;
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);
}
@@ -1300,9 +1300,9 @@
// used by LdapSearchEnumeration
private static String concatNames(String lesser, String greater) {
- if (lesser == null || lesser.equals("")) {
+ if (lesser == null || lesser.isEmpty()) {
return greater;
- } else if (greater == null || greater.equals("")) {
+ } else if (greater == null || greater.isEmpty()) {
return lesser;
} else {
return (lesser + "," + greater);
@@ -3036,7 +3036,7 @@
}
// 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);
} else {
e = new PartialResultException(msg);
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/LdapReferralContext.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/LdapReferralContext.java Fri Dec 07 11:51:17 2018 -0500
@@ -182,7 +182,7 @@
if (urlString == null) {
urlName = null;
} else {
- urlName = urlString.equals("") ? new CompositeName() :
+ urlName = urlString.isEmpty() ? new CompositeName() :
new CompositeName().add(urlString);
}
}
@@ -888,7 +888,7 @@
// ---------------------- Private methods ---------------------
private Name toName(String name) throws InvalidNameException {
- return name.equals("") ? new CompositeName() :
+ return name.isEmpty() ? new CompositeName() :
new CompositeName().add(name);
}
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/LdapSearchEnumeration.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/LdapSearchEnumeration.java Fri Dec 07 11:51:17 2018 -0500
@@ -97,13 +97,13 @@
// Name relative to search context
CompositeName cn = new CompositeName();
- if (!relStart.equals("")) {
+ if (!relStart.isEmpty()) {
cn.add(relStart);
}
// Name relative to homeCtx
CompositeName rcn = new CompositeName();
- if (!relHome.equals("")) {
+ if (!relHome.isEmpty()) {
rcn.add(relHome);
}
//System.err.println("relStart: " + cn);
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/LdapURL.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/LdapURL.java Fri Dec 07 11:51:17 2018 -0500
@@ -197,7 +197,7 @@
// path begins with a '/' or is empty
- if (path.equals("")) {
+ if (path.isEmpty()) {
return;
}
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/NamingEventNotifier.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/NamingEventNotifier.java Fri Dec 07 11:51:17 2018 -0500
@@ -115,7 +115,7 @@
try {
Continuation cont = new Continuation();
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);
results = context.searchAux(nm, info.filter, info.controls,
--- a/src/java.naming/share/classes/com/sun/jndi/toolkit/ctx/AtomicContext.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.naming/share/classes/com/sun/jndi/toolkit/ctx/AtomicContext.java Fri Dec 07 11:51:17 2018 -0500
@@ -243,7 +243,7 @@
protected boolean isEmpty(String name) {
- return name == null || name.equals("");
+ return name == null || name.isEmpty();
}
// ------ implementations of c_ and c_*_nns methods using
@@ -510,7 +510,7 @@
*/
protected void a_processJunction_nns(String name, Continuation cont)
throws NamingException {
- if (name.equals("")) {
+ if (name.isEmpty()) {
NameNotFoundException e = new NameNotFoundException();
cont.setErrorNNS(this, name);
throw cont.fillInException(e);
--- a/src/java.naming/share/classes/com/sun/jndi/toolkit/ctx/ComponentContext.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.naming/share/classes/com/sun/jndi/toolkit/ctx/ComponentContext.java Fri Dec 07 11:51:17 2018 -0500
@@ -105,7 +105,7 @@
throws NamingException {
int separator;
// 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;
} else {
separator = 1;
@@ -379,7 +379,7 @@
if (tail == null || tail.isEmpty()) {
//System.out.println("terminal : " + head);
ret = TERMINAL_COMPONENT;
- } else if (!tail.get(0).equals("")) {
+ } else if (!tail.get(0).isEmpty()) {
// tail does not begin with "/"
/*
if (head.isEmpty()) {
@@ -468,7 +468,7 @@
void checkAndAdjustRemainingName(Name rname) throws InvalidNameException {
int count;
if (rname != null && (count=rname.size()) > 1 &&
- rname.get(count-1).equals("")) {
+ rname.get(count-1).isEmpty()) {
rname.remove(count-1);
}
}
@@ -477,7 +477,7 @@
protected boolean isAllEmpty(Name n) {
int count = n.size();
for (int i =0; i < count; i++ ) {
- if (!n.get(i).equals("")) {
+ if (!n.get(i).isEmpty()) {
return false;
}
}
--- a/src/java.naming/share/classes/com/sun/jndi/toolkit/ctx/Continuation.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.naming/share/classes/com/sun/jndi/toolkit/ctx/Continuation.java Fri Dec 07 11:51:17 2018 -0500
@@ -203,7 +203,7 @@
public void setErrorNNS(Object resObj, String remain) {
CompositeName rname = new CompositeName();
try {
- if (remain != null && !remain.equals(""))
+ if (remain != null && !remain.isEmpty())
rname.add(remain);
rname.add("");
@@ -247,7 +247,7 @@
*/
public void setError(Object resObj, String remain) {
CompositeName rname = new CompositeName();
- if (remain != null && !remain.equals("")) {
+ if (remain != null && !remain.isEmpty()) {
try {
rname.add(remain);
} catch (InvalidNameException e) {
@@ -375,14 +375,14 @@
public void setContinue(Object obj, String relResName,
Context currCtx, String remain) {
CompositeName relname = new CompositeName();
- if (!relResName.equals("")) {
+ if (!relResName.isEmpty()) {
try {
relname.add(relResName);
} catch (NamingException e){}
}
CompositeName rname = new CompositeName();
- if (!remain.equals("")) {
+ if (!remain.isEmpty()) {
try {
rname.add(remain);
} catch (NamingException e) {
--- a/src/java.naming/share/classes/com/sun/jndi/toolkit/ctx/PartialCompositeContext.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.naming/share/classes/com/sun/jndi/toolkit/ctx/PartialCompositeContext.java Fri Dec 07 11:51:17 2018 -0500
@@ -477,9 +477,9 @@
int len = prefix.size();
if (!allEmpty(prefix) && !allEmpty(name)) {
- if (res.get(len - 1).equals("")) {
+ if (res.get(len - 1).isEmpty()) {
res.remove(len - 1);
- } else if (res.get(len).equals("")) {
+ } else if (res.get(len).isEmpty()) {
res.remove(len);
}
}
--- a/src/java.naming/share/classes/com/sun/jndi/toolkit/dir/ContextEnumerator.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.naming/share/classes/com/sun/jndi/toolkit/dir/ContextEnumerator.java Fri Dec 07 11:51:17 2018 -0500
@@ -138,7 +138,7 @@
// 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
// enumerating
- if(oldBinding.isRelative() && !contextName.equals("")) {
+ if(oldBinding.isRelative() && !contextName.isEmpty()) {
NameParser parser = root.getNameParser("");
Name newName = parser.parse(contextName);
newName.add(oldBinding.getName());
--- a/src/java.naming/share/classes/com/sun/jndi/toolkit/url/GenericURLContext.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.naming/share/classes/com/sun/jndi/toolkit/url/GenericURLContext.java Fri Dec 07 11:51:17 2018 -0500
@@ -476,9 +476,9 @@
public String composeName(String name, String prefix)
throws NamingException {
- if (prefix.equals("")) {
+ if (prefix.isEmpty()) {
return name;
- } else if (name.equals("")) {
+ } else if (name.isEmpty()) {
return prefix;
} else {
return (prefix + "/" + name);
--- a/src/java.net.http/share/classes/jdk/internal/net/http/Http1Request.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http1Request.java Fri Dec 07 11:51:17 2018 -0500
@@ -201,13 +201,13 @@
private String getPathAndQuery(URI uri) {
String path = uri.getRawPath();
String query = uri.getRawQuery();
- if (path == null || path.equals("")) {
+ if (path == null || path.isEmpty()) {
path = "/";
}
if (query == null) {
query = "";
}
- if (query.equals("")) {
+ if (query.isEmpty()) {
return Utils.encode(path);
} else {
return Utils.encode(path + "?" + query);
--- a/src/java.net.http/share/classes/jdk/internal/net/http/HttpRequestBuilderImpl.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/HttpRequestBuilderImpl.java Fri Dec 07 11:51:17 2018 -0500
@@ -190,7 +190,7 @@
@Override
public HttpRequest.Builder method(String method, BodyPublisher body) {
requireNonNull(method);
- if (method.equals(""))
+ if (method.isEmpty())
throw newIAE("illegal method <empty string>");
if (method.equals("CONNECT"))
throw newIAE("method CONNECT is not supported");
@@ -205,7 +205,7 @@
private HttpRequest.Builder method0(String method, BodyPublisher body) {
assert method != null;
- assert !method.equals("");
+ assert !method.isEmpty();
this.method = method;
this.bodyPublisher = body;
return this;
--- a/src/java.net.http/share/classes/jdk/internal/net/http/ResponseContent.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/ResponseContent.java Fri Dec 07 11:51:17 2018 -0500
@@ -84,7 +84,7 @@
if (contentLength == -1) {
String tc = headers.firstValue("Transfer-Encoding")
.orElse("");
- if (!tc.equals("")) {
+ if (!tc.isEmpty()) {
if (tc.equalsIgnoreCase("chunked")) {
chunkedContent = true;
} else {
--- a/src/java.net.http/share/classes/jdk/internal/net/http/common/SSLFlowDelegate.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/common/SSLFlowDelegate.java Fri Dec 07 11:51:17 2018 -0500
@@ -97,7 +97,7 @@
private static final ByteBuffer NOTHING = ByteBuffer.allocate(0);
private static final String monProp = Utils.getProperty("jdk.internal.httpclient.monitorFlowDelegate");
private static final boolean isMonitored =
- monProp != null && (monProp.equals("") || monProp.equalsIgnoreCase("true"));
+ monProp != null && (monProp.isEmpty() || monProp.equalsIgnoreCase("true"));
final Executor exec;
final Reader reader;
--- a/src/java.prefs/share/classes/java/util/prefs/AbstractPreferences.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.prefs/share/classes/java/util/prefs/AbstractPreferences.java Fri Dec 07 11:51:17 2018 -0500
@@ -203,7 +203,7 @@
*/
protected AbstractPreferences(AbstractPreferences parent, String name) {
if (parent==null) {
- if (!name.equals(""))
+ if (!name.isEmpty())
throw new IllegalArgumentException("Root name '"+name+
"' must be \"\"");
this.absolutePath = "/";
@@ -212,7 +212,7 @@
if (name.indexOf('/') != -1)
throw new IllegalArgumentException("Name '" + name +
"' contains '/'");
- if (name.equals(""))
+ if (name.isEmpty())
throw new IllegalArgumentException("Illegal name: empty string");
root = parent.root;
@@ -848,7 +848,7 @@
synchronized(lock) {
if (removed)
throw new IllegalStateException("Node has been removed.");
- if (path.equals(""))
+ if (path.isEmpty())
return this;
if (path.equals("/"))
return root;
@@ -911,7 +911,7 @@
throws BackingStoreException
{
synchronized(lock) {
- if (path.equals(""))
+ if (path.isEmpty())
return !removed;
if (removed)
throw new IllegalStateException("Node has been removed.");
--- a/src/java.rmi/share/classes/com/sun/rmi/rmid/ExecOptionPermission.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.rmi/share/classes/com/sun/rmi/rmid/ExecOptionPermission.java Fri Dec 07 11:51:17 2018 -0500
@@ -189,7 +189,7 @@
if (name == null)
throw new NullPointerException("name can't be null");
- if (name.equals("")) {
+ if (name.isEmpty()) {
throw new IllegalArgumentException("name can't be empty");
}
--- a/src/java.rmi/share/classes/java/rmi/Naming.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.rmi/share/classes/java/rmi/Naming.java Fri Dec 07 11:51:17 2018 -0500
@@ -199,7 +199,7 @@
Registry registry = getRegistry(parsed);
String prefix = "";
- if (parsed.port > 0 || !parsed.host.equals(""))
+ if (parsed.port > 0 || !parsed.host.isEmpty())
prefix += "//" + parsed.host;
if (parsed.port > 0)
prefix += ":" + parsed.port;
--- a/src/java.rmi/share/classes/sun/rmi/server/ActivatableRef.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.rmi/share/classes/sun/rmi/server/ActivatableRef.java Fri Dec 07 11:51:17 2018 -0500
@@ -370,7 +370,7 @@
ref = null;
String className = in.readUTF();
- if (className.equals("")) return;
+ if (className.isEmpty()) return;
try {
Class<?> refClass = Class.forName(RemoteRef.packagePrefix + "." +
--- a/src/java.rmi/share/classes/sun/rmi/server/Activation.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.rmi/share/classes/sun/rmi/server/Activation.java Fri Dec 07 11:51:17 2018 -0500
@@ -1857,7 +1857,7 @@
checkPermission(perms,
new ExecOptionPermission(option));
} catch (AccessControlException e) {
- if (value.equals("")) {
+ if (value.isEmpty()) {
checkPermission(perms,
new ExecOptionPermission("-D" + name));
} else {
@@ -2101,7 +2101,7 @@
* Initialize method for activation exec policy.
*/
if (!execPolicyClassName.equals("none")) {
- if (execPolicyClassName.equals("") ||
+ if (execPolicyClassName.isEmpty() ||
execPolicyClassName.equals("default"))
{
execPolicyClassName = DefaultExecPolicy.class.getName();
--- a/src/java.rmi/share/classes/sun/rmi/transport/tcp/TCPEndpoint.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.rmi/share/classes/sun/rmi/transport/tcp/TCPEndpoint.java Fri Dec 07 11:51:17 2018 -0500
@@ -738,7 +738,7 @@
}
hostName = f.getHost();
- if ((hostName == null) || (hostName.equals(""))
+ if ((hostName == null) || (hostName.isEmpty())
|| (hostName.indexOf('.') < 0 )) {
hostName = hostAddress;
--- a/src/java.scripting/share/classes/com/sun/tools/script/shell/Main.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.scripting/share/classes/com/sun/tools/script/shell/Main.java Fri Dec 07 11:51:17 2018 -0500
@@ -114,7 +114,7 @@
System.setProperty(value.substring(0, eq),
value.substring(eq + 1));
} else {
- if (!value.equals("")) {
+ if (!value.isEmpty()) {
System.setProperty(value, "");
} else {
// do not allow empty property name
--- a/src/java.sql.rowset/share/classes/com/sun/rowset/CachedRowSetImpl.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.sql.rowset/share/classes/com/sun/rowset/CachedRowSetImpl.java Fri Dec 07 11:51:17 2018 -0500
@@ -593,7 +593,7 @@
super.setCommand(cmd);
- if(!buildTableName(cmd).equals("")) {
+ if(!buildTableName(cmd).isEmpty()) {
this.setTableName(buildTableName(cmd));
}
}
@@ -7069,7 +7069,7 @@
public void setMatchColumn(String[] columnNames) throws SQLException {
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());
}
}
@@ -7124,7 +7124,7 @@
*/
public void setMatchColumn(String columnName) throws SQLException {
// 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());
} else {
// set strMatchColumn
--- a/src/java.sql.rowset/share/classes/com/sun/rowset/JdbcRowSetImpl.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.sql.rowset/share/classes/com/sun/rowset/JdbcRowSetImpl.java Fri Dec 07 11:51:17 2018 -0500
@@ -624,7 +624,7 @@
(getDataSourceName());
//return ds.getConnection(getUsername(),getPassword());
- if(getUsername() != null && !getUsername().equals("")) {
+ if(getUsername() != null && !getUsername().isEmpty()) {
return ds.getConnection(getUsername(),getPassword());
} else {
return ds.getConnection();
@@ -3873,7 +3873,7 @@
public void setMatchColumn(String[] columnNames) throws SQLException {
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());
}
}
@@ -3928,7 +3928,7 @@
*/
public void setMatchColumn(String columnName) throws SQLException {
// 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());
} else {
// set strMatchColumn
--- a/src/java.sql.rowset/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.sql.rowset/share/classes/com/sun/rowset/internal/WebRowSetXmlWriter.java Fri Dec 07 11:51:17 2018 -0500
@@ -537,7 +537,7 @@
private void writeStringData(String s) throws java.io.IOException {
if (s == null) {
writeNull();
- } else if (s.equals("")) {
+ } else if (s.isEmpty()) {
writeEmptyString();
} else {
--- a/src/java.sql.rowset/share/classes/javax/sql/rowset/BaseRowSet.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.sql.rowset/share/classes/javax/sql/rowset/BaseRowSet.java Fri Dec 07 11:51:17 2018 -0500
@@ -852,7 +852,7 @@
if (name == null) {
dataSource = null;
- } else if (name.equals("")) {
+ } else if (name.isEmpty()) {
throw new SQLException("DataSource name cannot be empty string");
} else {
dataSource = name;
--- a/src/java.sql/share/classes/java/sql/DriverManager.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.sql/share/classes/java/sql/DriverManager.java Fri Dec 07 11:51:17 2018 -0500
@@ -622,7 +622,7 @@
println("DriverManager.initialize: jdbc.drivers = " + drivers);
- if (drivers != null && !drivers.equals("")) {
+ if (drivers != null && !drivers.isEmpty()) {
String[] driversList = drivers.split(":");
println("number of Drivers:" + driversList.length);
for (String aDriver : driversList) {
--- a/src/java.xml/share/classes/com/sun/xml/internal/stream/events/AttributeImpl.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.xml/share/classes/com/sun/xml/internal/stream/events/AttributeImpl.java Fri Dec 07 11:51:17 2018 -0500
@@ -85,7 +85,7 @@
init();
fQName = qname ;
fValue = value ;
- if(type != null && !type.equals(""))
+ if(type != null && !type.isEmpty())
fAttributeType = type;
fNonNormalizedvalue = nonNormalizedvalue;
--- a/src/java.xml/share/classes/com/sun/xml/internal/stream/events/StartDocumentEvent.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.xml/share/classes/com/sun/xml/internal/stream/events/StartDocumentEvent.java Fri Dec 07 11:51:17 2018 -0500
@@ -73,7 +73,7 @@
this.fEncodingScheam = encoding;
this.fVersion = version;
this.fStandalone = standalone;
- if (encoding != null && !encoding.equals(""))
+ if (encoding != null && !encoding.isEmpty())
this.fEncodingSchemeSet = true;
else {
this.fEncodingSchemeSet = false;
--- a/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLDOMWriterImpl.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLDOMWriterImpl.java Fri Dec 07 11:51:17 2018 -0500
@@ -219,7 +219,7 @@
}
String qualifiedName = null;
- if(prefix.equals("")){
+ if(prefix.isEmpty()){
qualifiedName = localName;
}else{
qualifiedName = getQName(prefix,localName);
@@ -254,7 +254,7 @@
throw new XMLStreamException("prefix cannot be null");
}
String qualifiedName = null;
- if(prefix.equals("")){
+ if(prefix.isEmpty()){
qualifiedName = localName;
}else{
@@ -502,7 +502,7 @@
String qname = null;
- if (prefix.equals("")) {
+ if (prefix.isEmpty()) {
qname = XMLConstants.XMLNS_ATTRIBUTE;
} else {
qname = getQName(XMLConstants.XMLNS_ATTRIBUTE,prefix);
@@ -669,7 +669,7 @@
throw new XMLStreamException("Prefix cannot be null");
}
- if(prefix.equals("")){
+ if(prefix.isEmpty()){
qname = localName;
}else{
qname = getQName(prefix,localName);
--- a/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java Fri Dec 07 11:51:17 2018 -0500
@@ -628,8 +628,8 @@
}
if (!fIsRepairingNamespace) {
- if (prefix == null || prefix.equals("")){
- if (!namespaceURI.equals("")) {
+ if (prefix == null || prefix.isEmpty()){
+ if (!namespaceURI.isEmpty()) {
throw new XMLStreamException("prefix cannot be null or empty");
} else {
writeAttributeWithPrefix(null, localName, value);
@@ -908,7 +908,7 @@
} else {
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(":");
}
@@ -945,7 +945,7 @@
fWriter.write(OPEN_END_TAG);
if ((currentElement.prefix != null) &&
- !(currentElement.prefix).equals("")) {
+ !(currentElement.prefix).isEmpty()) {
fWriter.write(currentElement.prefix);
fWriter.write(":");
}
@@ -1180,19 +1180,19 @@
}
// Verify the encoding before writing anything
- if (encoding != null && !encoding.equals("")) {
+ if (encoding != null && !encoding.isEmpty()) {
verifyEncoding(encoding);
}
fWriter.write("<?xml version=\"");
- if ((version == null) || version.equals("")) {
+ if ((version == null) || version.isEmpty()) {
fWriter.write(DEFAULT_XML_VERSION);
} else {
fWriter.write(version);
}
- if (encoding != null && !encoding.equals("")) {
+ if (encoding != null && !encoding.isEmpty()) {
fWriter.write("\" encoding=\"");
fWriter.write(encoding);
}
@@ -1584,7 +1584,7 @@
attr = fAttributeCache.get(j);
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);
if ((tmp == null) || (!tmp.equals(attr.prefix))) {
@@ -1765,7 +1765,7 @@
for(int i=0 ; i< fAttributeCache.size();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);
}
}
@@ -1773,7 +1773,7 @@
if (!isDeclared(currentElement)) {
if ((currentElement.prefix != null) &&
(currentElement.uri != null)) {
- if ((!currentElement.prefix.equals("")) && (!currentElement.uri.equals(""))) {
+ if ((!currentElement.prefix.isEmpty()) && (!currentElement.uri.isEmpty())) {
fNamespaceDecls.add(currentElement);
}
}
@@ -1798,7 +1798,7 @@
/* 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].
*/
- 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);
}
}
--- a/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.xml/share/classes/javax/xml/catalog/CatalogFeatures.java Fri Dec 07 11:51:17 2018 -0500
@@ -619,13 +619,13 @@
private boolean getSystemProperty(Feature cf, String sysPropertyName) {
if (cf.hasSystemProperty()) {
String value = SecuritySupport.getSystemProperty(sysPropertyName);
- if (value != null && !value.equals("")) {
+ if (value != null && !value.isEmpty()) {
setProperty(cf, State.SYSTEMPROPERTY, value);
return true;
}
value = SecuritySupport.readJAXPProperty(sysPropertyName);
- if (value != null && !value.equals("")) {
+ if (value != null && !value.isEmpty()) {
setProperty(cf, State.JAXPDOTPROPERTIES, value);
return true;
}
--- a/src/java.xml/share/classes/javax/xml/catalog/Util.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.xml/share/classes/javax/xml/catalog/Util.java Fri Dec 07 11:51:17 2018 -0500
@@ -221,7 +221,7 @@
*/
static String[] getCatalogFiles(String sysPropertyName) {
String value = SecuritySupport.getJAXPSystemProperty(sysPropertyName);
- if (value != null && !value.equals("")) {
+ if (value != null && !value.isEmpty()) {
return value.split(";");
}
return null;
--- a/src/java.xml/share/classes/jdk/xml/internal/JdkXmlFeatures.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/java.xml/share/classes/jdk/xml/internal/JdkXmlFeatures.java Fri Dec 07 11:51:17 2018 -0500
@@ -383,13 +383,13 @@
private boolean getSystemProperty(XmlFeature feature, String sysPropertyName) {
try {
String value = SecuritySupport.getSystemProperty(sysPropertyName);
- if (value != null && !value.equals("")) {
+ if (value != null && !value.isEmpty()) {
setFeature(feature, State.SYSTEMPROPERTY, Boolean.parseBoolean(value));
return true;
}
value = SecuritySupport.readJAXPProperty(sysPropertyName);
- if (value != null && !value.equals("")) {
+ if (value != null && !value.isEmpty()) {
setFeature(feature, State.JAXPDOTPROPERTIES, Boolean.parseBoolean(value));
return true;
}
--- a/src/jdk.jartool/share/classes/sun/tools/jar/Main.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/jdk.jartool/share/classes/sun/tools/jar/Main.java Fri Dec 07 11:51:17 2018 -0500
@@ -1180,7 +1180,7 @@
String name = entry.name;
boolean isDir = entry.isDir;
- if (name.equals("") || name.equals(".") || name.equals(zname)) {
+ if (name.isEmpty() || name.equals(".") || name.equals(zname)) {
return;
} else if ((name.equals(MANIFEST_DIR) || name.equals(MANIFEST_NAME))
&& !Mflag) {
@@ -1886,7 +1886,7 @@
.map(ModuleInfoEntry::name)
.map(Main::versionFromEntryName)
.collect(joining(" "));
- if (!releases.equals(""))
+ if (!releases.isEmpty())
output("releases: " + releases + "\n");
// Describe the operative descriptor for the specified --release, if any
@@ -1955,7 +1955,7 @@
sb.append(md.toNameAndVersion());
- if (!uriString.equals(""))
+ if (!uriString.isEmpty())
sb.append(" ").append(uriString);
if (md.isOpen())
sb.append(" open");
--- a/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/javadoc/main/ClassDocImpl.java Fri Dec 07 11:51:17 2018 -0500
@@ -420,7 +420,7 @@
} else {
String n = "";
for ( ; c != null; c = c.owner.enclClass()) {
- n = c.name + (n.equals("") ? "" : ".") + n;
+ n = c.name + (n.isEmpty() ? "" : ".") + n;
}
return n;
}
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SearchIndexItem.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/SearchIndexItem.java Fri Dec 07 11:51:17 2018 -0500
@@ -114,18 +114,18 @@
item.append("\"m\":\"").append(containingModule).append("\",");
}
item.append("\"l\":\"").append(label).append("\"");
- if (!url.equals("")) {
+ if (!url.isEmpty()) {
item.append(",\"url\":\"").append(url).append("\"");
}
item.append("}");
break;
case TYPES:
item.append("{");
- if (!containingPackage.equals("")) {
+ if (!containingPackage.isEmpty()) {
item.append("\"p\":\"").append(containingPackage).append("\",");
}
item.append("\"l\":\"").append(label).append("\"");
- if (!url.equals("")) {
+ if (!url.isEmpty()) {
item.append(",\"url\":\"").append(url).append("\"");
}
item.append("}");
@@ -135,7 +135,7 @@
.append("\"p\":\"").append(containingPackage).append("\",")
.append("\"c\":\"").append(containingClass).append("\",")
.append("\"l\":\"").append(label).append("\"");
- if (!url.equals("")) {
+ if (!url.isEmpty()) {
item.append(",\"url\":\"").append(url).append("\"");
}
item.append("}");
@@ -144,7 +144,7 @@
item.append("{")
.append("\"l\":\"").append(label).append("\",")
.append("\"h\":\"").append(holder).append("\",");
- if (!description.equals("")) {
+ if (!description.isEmpty()) {
item.append("\"d\":\"").append(description).append("\",");
}
item.append("\"u\":\"").append(url).append("\"")
--- a/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/jdk.jcmd/share/classes/sun/tools/jmap/JMap.java Fri Dec 07 11:51:17 2018 -0500
@@ -149,7 +149,7 @@
throws AttachNotSupportedException, IOException,
UnsupportedEncodingException {
String liveopt = "-all";
- if (options.equals("") || options.equals("all")) {
+ if (options.isEmpty() || options.equals("all")) {
// pass
}
else if (options.equals("live")) {
--- a/src/jdk.jconsole/share/classes/sun/tools/jconsole/ConnectDialog.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/jdk.jconsole/share/classes/sun/tools/jconsole/ConnectDialog.java Fri Dec 07 11:51:17 2018 -0500
@@ -313,9 +313,9 @@
if (remoteRadioButton.isSelected()) {
String txt = remoteTF.getText().trim();
String userName = userNameTF.getText().trim();
- userName = userName.equals("") ? null : userName;
+ userName = userName.isEmpty() ? null : userName;
String password = passwordTF.getText();
- password = password.equals("") ? null : password;
+ password = password.isEmpty() ? null : password;
try {
if (txt.startsWith(JConsole.ROOT_URL)) {
String url = txt;
--- a/src/jdk.jconsole/share/classes/sun/tools/jconsole/ThreadTab.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/jdk.jconsole/share/classes/sun/tools/jconsole/ThreadTab.java Fri Dec 07 11:51:17 2018 -0500
@@ -665,7 +665,7 @@
}
public void focusLost(FocusEvent e) {
- if (promptRemoved && getText().equals("")) {
+ if (promptRemoved && getText().isEmpty()) {
setText(prompt);
setForeground(Color.gray);
promptRemoved = false;
--- a/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/jdk.management.agent/share/classes/jdk/internal/agent/Agent.java Fri Dec 07 11:51:17 2018 -0500
@@ -265,7 +265,7 @@
// return empty property set
private static Properties parseString(String args) {
Properties argProps = new Properties();
- if (args != null && !args.trim().equals("")) {
+ if (args != null && !args.trim().isEmpty()) {
for (String option : args.split(",")) {
String s[] = option.split("=", 2);
String name = s[0].trim();
--- a/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsContext.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsContext.java Fri Dec 07 11:51:17 2018 -0500
@@ -537,8 +537,8 @@
int prefixLast = prefixC.size() - 1;
// Let toolkit do the work at namespace boundaries.
- if (nameC.isEmpty() || nameC.get(0).equals("") ||
- prefixC.isEmpty() || prefixC.get(prefixLast).equals("")) {
+ if (nameC.isEmpty() || nameC.get(0).isEmpty() ||
+ prefixC.isEmpty() || prefixC.get(prefixLast).isEmpty()) {
return super.composeName(nameC, prefixC);
}
@@ -687,7 +687,7 @@
private static CT fromAttrId(String attrId)
throws InvalidAttributeIdentifierException {
- if (attrId.equals("")) {
+ if (attrId.isEmpty()) {
throw new InvalidAttributeIdentifierException(
"Attribute ID cannot be empty");
}
--- a/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsName.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsName.java Fri Dec 07 11:51:17 2018 -0500
@@ -368,7 +368,7 @@
boolean hasRootLabel() {
return (!isEmpty() &&
- get(0).equals(""));
+ get(0).isEmpty());
}
/*
@@ -442,7 +442,7 @@
// label of the name. Those two are special cases in that for
// all other domain names, the number of labels is one greater
// than the number of dot separators.
- if (!name.equals("") && !name.equals(".")) {
+ if (!name.isEmpty() && !name.equals(".")) {
add(0, label.toString());
}
--- a/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsUrl.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsUrl.java Fri Dec 07 11:51:17 2018 -0500
@@ -89,7 +89,7 @@
domain = path.startsWith("/")
? path.substring(1)
: path;
- domain = domain.equals("")
+ domain = domain.isEmpty()
? "."
: UrlUtil.decode(domain);
--- a/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/ResourceRecord.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/ResourceRecord.java Fri Dec 07 11:51:17 2018 -0500
@@ -200,7 +200,7 @@
}
private static int nameToValue(String name, String[] names) {
- if (name.equals("")) {
+ if (name.isEmpty()) {
return -1; // invalid name
} else if (name.equals("*")) {
return QTYPE_STAR; // QTYPE_STAR == QCLASS_STAR
--- a/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/ZoneNode.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/ZoneNode.java Fri Dec 07 11:51:17 2018 -0500
@@ -124,7 +124,7 @@
* name and its resource records. Returns the zone's new contents.
*/
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
NameNode newContents = new NameNode(null);
--- a/src/jdk.rmic/share/classes/sun/tools/java/ClassPath.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/jdk.rmic/share/classes/sun/tools/java/ClassPath.java Fri Dec 07 11:51:17 2018 -0500
@@ -230,7 +230,7 @@
int i = name.lastIndexOf(File.separatorChar);
subdir = name.substring(0, i + 1);
basename = name.substring(i + 1);
- } else if (!subdir.equals("")
+ } else if (!subdir.isEmpty()
&& !subdir.endsWith(fileSeparatorChar)) {
// zip files are picky about "foo" vs. "foo/".
// also, the getFiles caches are keyed with a trailing /
--- a/src/jdk.rmic/share/classes/sun/tools/java/Package.java Fri Dec 07 17:11:17 2018 +0100
+++ b/src/jdk.rmic/share/classes/sun/tools/java/Package.java Fri Dec 07 11:51:17 2018 -0500
@@ -115,7 +115,7 @@
}
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 @@
}
public String toString() {
- if (pkg.equals("")) {
+ if (pkg.isEmpty()) {
return "unnamed package";
}
return "package " + pkg;