You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by lu...@apache.org on 2019/12/29 08:10:30 UTC

[struts] 12/14: WW-5047 Avoids confusion about scope's default value

This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a commit to branch WW-5049-velocity-plugin
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 503c8b7623767a5cbb97b361a34ca619114ef7b1
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Thu Dec 26 09:34:41 2019 +0100

    WW-5047 Avoids confusion about scope's default value
---
 .../xwork2/config/providers/XmlConfigurationProvider.java           | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java b/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java
index 04aad76..ce1587d 100644
--- a/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java
+++ b/core/src/main/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProvider.java
@@ -242,15 +242,19 @@ public class XmlConfigurationProvider implements ConfigurationProvider {
                         String onlyStatic = child.getAttribute("static");
                         String scopeStr = child.getAttribute("scope");
                         boolean optional = "true".equals(child.getAttribute("optional"));
-                        Scope scope = Scope.SINGLETON;
+                        Scope scope;
                         if ("prototype".equals(scopeStr)) {
                             scope = Scope.PROTOTYPE;
                         } else if ("request".equals(scopeStr)) {
                             scope = Scope.REQUEST;
                         } else if ("session".equals(scopeStr)) {
                             scope = Scope.SESSION;
+                        } else if ("singleton".equals(scopeStr)) {
+                            scope = Scope.SINGLETON;
                         } else if ("thread".equals(scopeStr)) {
                             scope = Scope.THREAD;
+                        } else {
+                            scope = Scope.SINGLETON;
                         }
 
                         if (StringUtils.isEmpty(name)) {