From bb3ff25cad3c9b32abd002ddb0d28639b49031fa Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 21 Dec 2015 23:07:32 +0100 Subject: [PATCH] Polishing --- .../propertyeditors/ResourceBundleEditor.java | 6 +++--- .../ResourceBundleEditorTests.java | 15 ++++++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/ResourceBundleEditor.java b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/ResourceBundleEditor.java index 3a95ef51ef..7eabc102b7 100644 --- a/spring-beans/src/main/java/org/springframework/beans/propertyeditors/ResourceBundleEditor.java +++ b/spring-beans/src/main/java/org/springframework/beans/propertyeditors/ResourceBundleEditor.java @@ -61,8 +61,8 @@ import org.springframework.util.StringUtils; * </property> * </bean> * - *

Please note that this {@link java.beans.PropertyEditor} is - * not registered by default with any of the Spring infrastructure. + *

Please note that this {@link java.beans.PropertyEditor} is not + * registered by default with any of the Spring infrastructure. * *

Thanks to David Leal Valmana for the suggestion and initial prototype. * @@ -89,7 +89,7 @@ public class ResourceBundleEditor extends PropertyEditorSupport { setValue(ResourceBundle.getBundle(name)); } else { - // Tge basename potentially has locale information + // The name potentially contains locale information String baseName = name.substring(0, separator); if (!StringUtils.hasText(baseName)) { throw new IllegalArgumentException("Invalid ResourceBundle name: '" + text + "'"); diff --git a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/ResourceBundleEditorTests.java b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/ResourceBundleEditorTests.java index 20b688fad4..613959dc3c 100644 --- a/spring-beans/src/test/java/org/springframework/beans/propertyeditors/ResourceBundleEditorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/propertyeditors/ResourceBundleEditorTests.java @@ -41,7 +41,8 @@ public class ResourceBundleEditorTests { editor.setAsText(BASE_NAME); Object value = editor.getValue(); assertNotNull("Returned ResourceBundle was null (must not be for valid setAsText(..) call).", value); - assertTrue("Returned object was not a ResourceBundle (must be for valid setAsText(..) call).", value instanceof ResourceBundle); + assertTrue("Returned object was not a ResourceBundle (must be for valid setAsText(..) call).", + value instanceof ResourceBundle); ResourceBundle bundle = (ResourceBundle) value; String string = bundle.getString(MESSAGE_KEY); assertEquals(MESSAGE_KEY, string); @@ -53,7 +54,8 @@ public class ResourceBundleEditorTests { editor.setAsText(BASE_NAME + "_"); Object value = editor.getValue(); assertNotNull("Returned ResourceBundle was null (must not be for valid setAsText(..) call).", value); - assertTrue("Returned object was not a ResourceBundle (must be for valid setAsText(..) call).", value instanceof ResourceBundle); + assertTrue("Returned object was not a ResourceBundle (must be for valid setAsText(..) call).", + value instanceof ResourceBundle); ResourceBundle bundle = (ResourceBundle) value; String string = bundle.getString(MESSAGE_KEY); assertEquals(MESSAGE_KEY, string); @@ -65,7 +67,8 @@ public class ResourceBundleEditorTests { editor.setAsText(BASE_NAME + "Lang" + "_en"); Object value = editor.getValue(); assertNotNull("Returned ResourceBundle was null (must not be for valid setAsText(..) call).", value); - assertTrue("Returned object was not a ResourceBundle (must be for valid setAsText(..) call).", value instanceof ResourceBundle); + assertTrue("Returned object was not a ResourceBundle (must be for valid setAsText(..) call).", + value instanceof ResourceBundle); ResourceBundle bundle = (ResourceBundle) value; String string = bundle.getString(MESSAGE_KEY); assertEquals("yob", string); @@ -77,7 +80,8 @@ public class ResourceBundleEditorTests { editor.setAsText(BASE_NAME + "LangCountry" + "_en_GB"); Object value = editor.getValue(); assertNotNull("Returned ResourceBundle was null (must not be for valid setAsText(..) call).", value); - assertTrue("Returned object was not a ResourceBundle (must be for valid setAsText(..) call).", value instanceof ResourceBundle); + assertTrue("Returned object was not a ResourceBundle (must be for valid setAsText(..) call).", + value instanceof ResourceBundle); ResourceBundle bundle = (ResourceBundle) value; String string = bundle.getString(MESSAGE_KEY); assertEquals("chav", string); @@ -89,7 +93,8 @@ public class ResourceBundleEditorTests { editor.setAsText(BASE_NAME + "LangCountryDialect" + "_en_GB_GLASGOW"); Object value = editor.getValue(); assertNotNull("Returned ResourceBundle was null (must not be for valid setAsText(..) call).", value); - assertTrue("Returned object was not a ResourceBundle (must be for valid setAsText(..) call).", value instanceof ResourceBundle); + assertTrue("Returned object was not a ResourceBundle (must be for valid setAsText(..) call).", + value instanceof ResourceBundle); ResourceBundle bundle = (ResourceBundle) value; String string = bundle.getString(MESSAGE_KEY); assertEquals("ned", string);