Polish empty string checks
See gh-23550
This commit is contained in:
committed by
Stephane Nicoll
parent
294af45bb3
commit
5cb07e292d
@@ -298,7 +298,7 @@ public class ConfigurationMetadataAnnotationProcessor extends AbstractProcessor
|
||||
private void processEndpoint(AnnotationMirror annotation, TypeElement element) {
|
||||
Map<String, Object> elementValues = this.metadataEnv.getAnnotationElementValues(annotation);
|
||||
String endpointId = (String) elementValues.get("id");
|
||||
if (endpointId == null || "".equals(endpointId)) {
|
||||
if (endpointId == null || endpointId.isEmpty()) {
|
||||
return; // Can't process that endpoint
|
||||
}
|
||||
String endpointKey = ItemMetadata.newItemMetadataPrefix("management.endpoint.", endpointId);
|
||||
|
||||
@@ -180,8 +180,8 @@ class MetadataGenerationEnvironment {
|
||||
reason = (String) elementValues.get("reason");
|
||||
replacement = (String) elementValues.get("replacement");
|
||||
}
|
||||
reason = "".equals(reason) ? null : reason;
|
||||
replacement = "".equals(replacement) ? null : replacement;
|
||||
reason = (reason == null || reason.isEmpty()) ? null : reason;
|
||||
replacement = (replacement == null || replacement.isEmpty()) ? null : replacement;
|
||||
return new ItemDeprecation(reason, replacement);
|
||||
}
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ class TypeUtils {
|
||||
if (javadoc != null) {
|
||||
javadoc = NEW_LINE_PATTERN.matcher(javadoc).replaceAll("").trim();
|
||||
}
|
||||
return "".equals(javadoc) ? null : javadoc;
|
||||
return (javadoc == null || javadoc.isEmpty()) ? null : javadoc;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -171,7 +171,7 @@ public class ConfigurationMetadata {
|
||||
public static String nestedPrefix(String prefix, String name) {
|
||||
String nestedPrefix = (prefix != null) ? prefix : "";
|
||||
String dashedName = toDashedCase(name);
|
||||
nestedPrefix += "".equals(nestedPrefix) ? dashedName : "." + dashedName;
|
||||
nestedPrefix += (nestedPrefix == null || nestedPrefix.isEmpty()) ? dashedName : "." + dashedName;
|
||||
return nestedPrefix;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user