Polish empty string checks

See gh-23550
This commit is contained in:
Santhoshkumar. P
2020-10-01 08:21:49 +05:30
committed by Stephane Nicoll
parent 294af45bb3
commit 5cb07e292d
8 changed files with 11 additions and 10 deletions

View File

@@ -316,7 +316,7 @@ public class PropertiesLauncher extends Launcher {
for (String path : commaSeparatedPaths.split(",")) {
path = cleanupPath(path);
// "" means the user wants root of archive but not current directory
path = "".equals(path) ? "/" : path;
path = (path == null || path.isEmpty()) ? "/" : path;
paths.add(path);
}
if (paths.isEmpty()) {
@@ -631,7 +631,7 @@ public class PropertiesLauncher extends Launcher {
}
EntryFilter filter = new PrefixMatchingArchiveFilter(root);
List<Archive> archives = asList(parent.getNestedArchives(null, filter));
if (("".equals(root) || ".".equals(root)) && !path.endsWith(".jar")
if ((root == null || root.isEmpty() || ".".equals(root)) && !path.endsWith(".jar")
&& parent != PropertiesLauncher.this.parent) {
// You can't find the root with an entry filter so it has to be added
// explicitly. But don't add the root of the parent archive.

View File

@@ -413,7 +413,7 @@ public class JarFile extends AbstractJarFile implements Iterable<java.util.jar.J
public static void registerUrlProtocolHandler() {
String handlers = System.getProperty(PROTOCOL_HANDLER, "");
System.setProperty(PROTOCOL_HANDLER,
("".equals(handlers) ? HANDLERS_PACKAGE : handlers + "|" + HANDLERS_PACKAGE));
((handlers == null || handlers.isEmpty()) ? HANDLERS_PACKAGE : handlers + "|" + HANDLERS_PACKAGE));
resetCachedUrlHandlers();
}