Repository: struts Updated Branches: refs/heads/master e60119436 -> 1afb48aa7
Inlines constants and drops class Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/ca256a74 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/ca256a74 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/ca256a74 Branch: refs/heads/master Commit: ca256a74e98861a70c446b309dbe8ca1669dbba6 Parents: e601194 Author: Lukasz Lenart <[email protected]> Authored: Sun Jun 12 15:22:45 2016 +0200 Committer: Lukasz Lenart <[email protected]> Committed: Sun Jun 12 15:22:45 2016 +0200 ---------------------------------------------------------------------- .../com/opensymphony/xwork2/XWorkMessages.java | 31 -------------------- .../xwork2/conversion/impl/XWorkConverter.java | 2 +- .../xwork2/util/LocalizedTextUtilTest.java | 13 ++++---- 3 files changed, 6 insertions(+), 40 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/ca256a74/core/src/main/java/com/opensymphony/xwork2/XWorkMessages.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/com/opensymphony/xwork2/XWorkMessages.java b/core/src/main/java/com/opensymphony/xwork2/XWorkMessages.java deleted file mode 100644 index d187acc..0000000 --- a/core/src/main/java/com/opensymphony/xwork2/XWorkMessages.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2002-2006,2009 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.opensymphony.xwork2; - - -/** - * Contains constants for some default XWork messages. - * - * @author Jason Carreira - */ -public interface XWorkMessages { - - public static final String ACTION_EXECUTION_ERROR = "xwork.error.action.execution"; - public static final String MISSING_ACTION_EXCEPTION = "xwork.exception.missing-action"; - public static final String MISSING_PACKAGE_ACTION_EXCEPTION = "xwork.exception.missing-package-action"; - public static final String DEFAULT_INVALID_FIELDVALUE = "xwork.default.invalid.fieldvalue"; - -} http://git-wip-us.apache.org/repos/asf/struts/blob/ca256a74/core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java b/core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java index c946d70..9dfcd4d 100644 --- a/core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java +++ b/core/src/main/java/com/opensymphony/xwork2/conversion/impl/XWorkConverter.java @@ -194,7 +194,7 @@ public class XWorkConverter extends DefaultTypeConverter { } public static String getConversionErrorMessage(String propertyName, ValueStack stack) { - String defaultMessage = LocalizedTextUtil.findDefaultText(XWorkMessages.DEFAULT_INVALID_FIELDVALUE, + String defaultMessage = LocalizedTextUtil.findDefaultText("xwork.default.invalid.fieldvalue", ActionContext.getContext().getLocale(), new Object[]{ propertyName http://git-wip-us.apache.org/repos/asf/struts/blob/ca256a74/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java b/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java index 1205852..f09bc9b 100644 --- a/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/util/LocalizedTextUtilTest.java @@ -20,10 +20,7 @@ import com.opensymphony.xwork2.*; import com.opensymphony.xwork2.config.providers.XmlConfigurationProvider; import com.opensymphony.xwork2.test.ModelDrivenAction2; import com.opensymphony.xwork2.test.TestBean2; -import org.apache.struts2.util.DateFormatter; -import org.springframework.format.annotation.DateTimeFormat; -import javax.swing.text.Style; import java.text.DateFormat; import java.text.ParseException; import java.util.Date; @@ -134,17 +131,17 @@ public class LocalizedTextUtilTest extends XWorkTestCase { } public void testDefaultMessage() throws Exception { - String message = LocalizedTextUtil.findDefaultText(XWorkMessages.ACTION_EXECUTION_ERROR, Locale.getDefault()); + String message = LocalizedTextUtil.findDefaultText("xwork.error.action.execution", Locale.getDefault()); assertEquals("Error during Action invocation", message); } public void testDefaultMessageOverride() throws Exception { - String message = LocalizedTextUtil.findDefaultText(XWorkMessages.ACTION_EXECUTION_ERROR, Locale.getDefault()); + String message = LocalizedTextUtil.findDefaultText("xwork.error.action.execution", Locale.getDefault()); assertEquals("Error during Action invocation", message); LocalizedTextUtil.addDefaultResourceBundle("com/opensymphony/xwork2/test"); - message = LocalizedTextUtil.findDefaultText(XWorkMessages.ACTION_EXECUTION_ERROR, Locale.getDefault()); + message = LocalizedTextUtil.findDefaultText("xwork.error.action.execution", Locale.getDefault()); assertEquals("Testing resource bundle override", message); } @@ -187,12 +184,12 @@ public class LocalizedTextUtilTest extends XWorkTestCase { } public void testParameterizedDefaultMessage() throws Exception { - String message = LocalizedTextUtil.findDefaultText(XWorkMessages.MISSING_ACTION_EXCEPTION, Locale.getDefault(), new String[]{"AddUser"}); + String message = LocalizedTextUtil.findDefaultText("xwork.exception.missing-action", Locale.getDefault(), new String[]{"AddUser"}); assertEquals("There is no Action mapped for action name AddUser.", message); } public void testParameterizedDefaultMessageWithPackage() throws Exception { - String message = LocalizedTextUtil.findDefaultText(XWorkMessages.MISSING_PACKAGE_ACTION_EXCEPTION, Locale.getDefault(), new String[]{"blah", "AddUser"}); + String message = LocalizedTextUtil.findDefaultText("xwork.exception.missing-package-action", Locale.getDefault(), new String[]{"blah", "AddUser"}); assertEquals("There is no Action mapped for namespace blah and action name AddUser.", message); }
