diff --git a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/StringTrimmerEditor.java b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/StringTrimmerEditor.java index 8bd512cbd3..5473692129 100644 --- a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/StringTrimmerEditor.java +++ b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/StringTrimmerEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -72,7 +72,7 @@ public class StringTrimmerEditor extends PropertyEditorSupport { if (this.charsToDelete != null) { value = StringUtils.deleteAny(value, this.charsToDelete); } - if (this.emptyAsNull && "".equals(value)) { + if (this.emptyAsNull && value.isEmpty()) { setValue(null); } else { diff --git a/spring-context/src/main/java/org/springframework/jndi/JndiTemplateEditor.java b/spring-context/src/main/java/org/springframework/jndi/JndiTemplateEditor.java index 9b5ad25ff7..098bae9b7e 100644 --- a/spring-context/src/main/java/org/springframework/jndi/JndiTemplateEditor.java +++ b/spring-context/src/main/java/org/springframework/jndi/JndiTemplateEditor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ public class JndiTemplateEditor extends PropertyEditorSupport { if (text == null) { throw new IllegalArgumentException("JndiTemplate cannot be created from null string"); } - if ("".equals(text)) { + if (text.isEmpty()) { // empty environment setValue(new JndiTemplate()); } diff --git a/spring-orm/src/main/java/org/springframework/orm/jpa/support/PersistenceAnnotationBeanPostProcessor.java b/spring-orm/src/main/java/org/springframework/orm/jpa/support/PersistenceAnnotationBeanPostProcessor.java index 3965596b1c..eea66f6a16 100644 --- a/spring-orm/src/main/java/org/springframework/orm/jpa/support/PersistenceAnnotationBeanPostProcessor.java +++ b/spring-orm/src/main/java/org/springframework/orm/jpa/support/PersistenceAnnotationBeanPostProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -472,7 +472,7 @@ public class PersistenceAnnotationBeanPostProcessor unitNameForLookup = this.defaultPersistenceUnitName; } String jndiName = this.persistenceUnits.get(unitNameForLookup); - if (jndiName == null && "".equals(unitNameForLookup) && this.persistenceUnits.size() == 1) { + if (jndiName == null && unitNameForLookup.isEmpty() && this.persistenceUnits.size() == 1) { jndiName = this.persistenceUnits.values().iterator().next(); } if (jndiName != null) { @@ -505,7 +505,7 @@ public class PersistenceAnnotationBeanPostProcessor unitNameForLookup = this.defaultPersistenceUnitName; } String jndiName = contexts.get(unitNameForLookup); - if (jndiName == null && "".equals(unitNameForLookup) && contexts.size() == 1) { + if (jndiName == null && unitNameForLookup.isEmpty() && contexts.size() == 1) { jndiName = contexts.values().iterator().next(); } if (jndiName != null) { diff --git a/spring-test/src/main/java/org/springframework/test/web/servlet/htmlunit/MockMvcWebConnection.java b/spring-test/src/main/java/org/springframework/test/web/servlet/htmlunit/MockMvcWebConnection.java index 743316b11b..3554211771 100644 --- a/spring-test/src/main/java/org/springframework/test/web/servlet/htmlunit/MockMvcWebConnection.java +++ b/spring-test/src/main/java/org/springframework/test/web/servlet/htmlunit/MockMvcWebConnection.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -110,7 +110,7 @@ public final class MockMvcWebConnection implements WebConnection { * @param contextPath the path to validate */ static void validateContextPath(@Nullable String contextPath) { - if (contextPath == null || "".equals(contextPath)) { + if (contextPath == null || contextPath.isEmpty()) { return; } Assert.isTrue(contextPath.startsWith("/"), () -> "contextPath '" + contextPath + "' must start with '/'."); diff --git a/spring-test/src/main/java/org/springframework/test/web/servlet/setup/PatternMappingFilterProxy.java b/spring-test/src/main/java/org/springframework/test/web/servlet/setup/PatternMappingFilterProxy.java index 868c0a7b92..403157895e 100644 --- a/spring-test/src/main/java/org/springframework/test/web/servlet/setup/PatternMappingFilterProxy.java +++ b/spring-test/src/main/java/org/springframework/test/web/servlet/setup/PatternMappingFilterProxy.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2016 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -82,7 +82,7 @@ final class PatternMappingFilterProxy implements Filter { this.exactMatches.add(urlPattern.substring(0, urlPattern.length() - 2)); } else { - if ("".equals(urlPattern)) { + if (urlPattern.isEmpty()) { urlPattern = "/"; } this.exactMatches.add(urlPattern); diff --git a/spring-web/src/main/java/org/springframework/web/util/WebUtils.java b/spring-web/src/main/java/org/springframework/web/util/WebUtils.java index 5face07f54..5bb0ed36ff 100644 --- a/spring-web/src/main/java/org/springframework/web/util/WebUtils.java +++ b/spring-web/src/main/java/org/springframework/web/util/WebUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2018 the original author or authors. + * Copyright 2002-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -695,7 +695,7 @@ public abstract class WebUtils { } while (paramNames != null && paramNames.hasMoreElements()) { String paramName = paramNames.nextElement(); - if ("".equals(prefix) || paramName.startsWith(prefix)) { + if (prefix.isEmpty() || paramName.startsWith(prefix)) { String unprefixed = paramName.substring(prefix.length()); String[] values = request.getParameterValues(paramName); if (values == null || values.length == 0) {