refactor: improved null check
@@ -41,15 +41,13 @@ public class DetectorEvaluationNameVersionDecider {
}
private DetectorType preferredDetectorTypeFromString(String detectorType) {
-
- String detectorTypeUppercase = null;
- if (detectorType != null) {
- detectorTypeUppercase = detectorType.toUpperCase();
- }
DetectorType castDetectorType = null;
- if (StringUtils.isNotBlank(detectorType) && DetectorType.getPossibleNames().contains(detectorTypeUppercase)) {
+ if (StringUtils.isNotBlank(detectorType)) {
+ String detectorTypeUppercase = detectorType.toUpperCase();
+ if (DetectorType.getPossibleNames().contains(detectorTypeUppercase)) {
castDetectorType = DetectorType.valueOf(detectorTypeUppercase);
}
+ }
// In Kotlin this check was to see if castDetectorType != null but that doesn't make any sense...
if (castDetectorType == null) {
logger.debug("A valid preferred detector type was not provided, deciding project name automatically.");
