diff options
author | Leif Åstrand <leif@vaadin.com> | 2013-06-14 09:58:20 +0300 |
---|---|---|
committer | Leif Åstrand <leif@vaadin.com> | 2013-06-14 09:58:20 +0300 |
commit | b4fc9bc00801780f94614882727842b933eba659 (patch) | |
tree | 8903c10d89b011aeced9fe0a23e04e5a5a0cf856 /server/src | |
parent | d5dbae8b654bfa5c679b64264244fa21f2e89b86 (diff) | |
download | vaadin-framework-b4fc9bc00801780f94614882727842b933eba659.tar.gz vaadin-framework-b4fc9bc00801780f94614882727842b933eba659.zip |
Define LegacyPropertyToStringMode parameter strings in the enum (#11970)
Change-Id: Ia6a0b5f63ef1290a2054307e5dd2d34f6628fa64
Diffstat (limited to 'server/src')
-rw-r--r-- | server/src/com/vaadin/server/DefaultDeploymentConfiguration.java | 33 | ||||
-rw-r--r-- | server/src/com/vaadin/server/DeploymentConfiguration.java | 24 |
2 files changed, 38 insertions, 19 deletions
diff --git a/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java b/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java index 993d60133b..519d81eb6d 100644 --- a/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java +++ b/server/src/com/vaadin/server/DefaultDeploymentConfiguration.java @@ -86,27 +86,24 @@ public class DefaultDeploymentConfiguration implements DeploymentConfiguration { } private void checkLegacyPropertyToString() { - // Verify that the default value has not changed without also - // updating logic here - assert DEFAULT_LEGACY_PROPERTY_TO_STRING == LegacyProperyToStringMode.WARNING; - String param = getApplicationOrSystemProperty( - Constants.SERVLET_PARAMETER_LEGACY_PROPERTY_TOSTRING, "warning"); - - if ("true".equals(param)) { - legacyPropertyToStringMode = LegacyProperyToStringMode.ENABLED; - } else if ("false".equals(param)) { - legacyPropertyToStringMode = LegacyProperyToStringMode.DISABLED; - } else { - if (!"warning".equals(param)) { - getLogger() - .log(Level.WARNING, - Constants.WARNING_UNKNOWN_LEGACY_PROPERTY_TOSTRING_VALUE, - param); - + Constants.SERVLET_PARAMETER_LEGACY_PROPERTY_TOSTRING, + DEFAULT_LEGACY_PROPERTY_TO_STRING.getPropertyString()); + + for (LegacyProperyToStringMode mode : LegacyProperyToStringMode + .values()) { + if (mode.getPropertyString().equals(param)) { + legacyPropertyToStringMode = mode; + return; } - legacyPropertyToStringMode = DEFAULT_LEGACY_PROPERTY_TO_STRING; } + + getLogger() + .log(Level.WARNING, + Constants.WARNING_UNKNOWN_LEGACY_PROPERTY_TOSTRING_VALUE, + param); + + legacyPropertyToStringMode = DEFAULT_LEGACY_PROPERTY_TO_STRING; } @Override diff --git a/server/src/com/vaadin/server/DeploymentConfiguration.java b/server/src/com/vaadin/server/DeploymentConfiguration.java index bf9c019b6d..8c24379db3 100644 --- a/server/src/com/vaadin/server/DeploymentConfiguration.java +++ b/server/src/com/vaadin/server/DeploymentConfiguration.java @@ -40,7 +40,29 @@ public interface DeploymentConfiguration extends Serializable { */ @Deprecated public enum LegacyProperyToStringMode { - DISABLED, WARNING, ENABLED; + DISABLED("false"), WARNING("warning"), ENABLED("true"); + + private final String propertyString; + + private LegacyProperyToStringMode(String propertyString) { + this.propertyString = propertyString; + } + + /** + * Gets the string that should be used in e.g. web.xml for selecting + * this mode. + * + * @return the property value + */ + public String getPropertyString() { + return propertyString; + } + + @Override + public String toString() { + // Used by VaadinServlet.readConfigurationAnnotation() + return getPropertyString(); + } public boolean useLegacyMode() { return this == WARNING || this == ENABLED; |