mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 14:24:46 +02:00
8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: dfuchs, alanb
This commit is contained in:
parent
c998ead188
commit
a3df1d618e
155 changed files with 340 additions and 382 deletions
|
@ -996,7 +996,7 @@ class Attribute implements Comparable<Attribute> {
|
|||
endp = cstr.indexOf(',', cp);
|
||||
if (endp < 0) endp = cstrlen;
|
||||
String cstr1 = cstr.substring(cp, endp);
|
||||
if (cstr1.length() == 0)
|
||||
if (cstr1.isEmpty())
|
||||
cstr1 = "empty"; // will fail parse
|
||||
int value0, value1;
|
||||
// Check for a case range (new in 1.6).
|
||||
|
|
|
@ -279,7 +279,7 @@ class Driver {
|
|||
junpack.properties().putAll(engProps);
|
||||
if (doRepack && newfile.equals(jarfile)) {
|
||||
String zipc = getZipComment(jarfile);
|
||||
if (verbose && zipc.length() > 0)
|
||||
if (verbose && !zipc.isEmpty())
|
||||
System.out.println(MessageFormat.format(RESOURCE.getString(DriverResource.DETECTED_ZIP_COMMENT), zipc));
|
||||
if (zipc.indexOf(Utils.PACK_ZIP_ARCHIVE_MARKER_COMMENT) >= 0) {
|
||||
System.out.println(MessageFormat.format(RESOURCE.getString(DriverResource.SKIP_FOR_REPACKED), jarfile));
|
||||
|
@ -552,7 +552,7 @@ class Driver {
|
|||
if (words.length == 0) continue loadOptmap;
|
||||
String opt = words[0];
|
||||
words[0] = ""; // initial word is not a spec
|
||||
if (opt.length() == 0 && words.length >= 1) {
|
||||
if (opt.isEmpty() && words.length >= 1) {
|
||||
opt = words[1]; // initial "word" is empty due to leading ' '
|
||||
words[1] = "";
|
||||
}
|
||||
|
@ -622,7 +622,7 @@ class Driver {
|
|||
switch (specop) {
|
||||
case '+':
|
||||
// + means we want an non-empty val suffix.
|
||||
ok = (val.length() != 0);
|
||||
ok = !val.isEmpty();
|
||||
specop = spec.charAt(sidx++);
|
||||
break;
|
||||
case '*':
|
||||
|
@ -641,10 +641,10 @@ class Driver {
|
|||
String specarg = spec.substring(sidx);
|
||||
switch (specop) {
|
||||
case '.': // terminate the option sequence
|
||||
resultString = (specarg.length() != 0)? specarg.intern(): opt;
|
||||
resultString = specarg.isEmpty() ? opt : specarg.intern();
|
||||
break doArgs;
|
||||
case '?': // abort the option sequence
|
||||
resultString = (specarg.length() != 0)? specarg.intern(): arg;
|
||||
resultString = specarg.isEmpty() ? arg : specarg.intern();
|
||||
isError = true;
|
||||
break eachSpec;
|
||||
case '@': // change the effective opt name
|
||||
|
@ -655,14 +655,14 @@ class Driver {
|
|||
val = "";
|
||||
break;
|
||||
case '!': // negation option
|
||||
String negopt = (specarg.length() != 0)? specarg.intern(): opt;
|
||||
String negopt = specarg.isEmpty() ? opt : specarg.intern();
|
||||
properties.remove(negopt);
|
||||
properties.put(negopt, null); // leave placeholder
|
||||
didAction = true;
|
||||
break;
|
||||
case '$': // normal "boolean" option
|
||||
String boolval;
|
||||
if (specarg.length() != 0) {
|
||||
if (!specarg.isEmpty()) {
|
||||
// If there is a given spec token, store it.
|
||||
boolval = specarg;
|
||||
} else {
|
||||
|
|
|
@ -153,7 +153,7 @@ public class KeyManagerFactory {
|
|||
String provider)
|
||||
throws NoSuchAlgorithmException, NoSuchProviderException
|
||||
{
|
||||
if (provider == null || provider.length() == 0)
|
||||
if (provider == null || provider.isEmpty())
|
||||
throw new IllegalArgumentException("missing provider");
|
||||
Object[] objs = SSLSecurity.getImpl(algorithm, "KeyManagerFactory",
|
||||
provider);
|
||||
|
|
|
@ -109,7 +109,7 @@ public class SSLContext {
|
|||
public static SSLContext getInstance(String protocol, String provider)
|
||||
throws NoSuchAlgorithmException, NoSuchProviderException
|
||||
{
|
||||
if (provider == null || provider.length() == 0)
|
||||
if (provider == null || provider.isEmpty())
|
||||
throw new IllegalArgumentException("missing provider");
|
||||
Object[] objs = SSLSecurity.getImpl(protocol, "SSLContext",
|
||||
provider);
|
||||
|
|
|
@ -155,7 +155,7 @@ public class TrustManagerFactory {
|
|||
String provider)
|
||||
throws NoSuchAlgorithmException, NoSuchProviderException
|
||||
{
|
||||
if (provider == null || provider.length() == 0)
|
||||
if (provider == null || provider.isEmpty())
|
||||
throw new IllegalArgumentException("missing provider");
|
||||
Object[] objs = SSLSecurity.getImpl(algorithm, "TrustManagerFactory",
|
||||
provider);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue