diff --git a/core/src/main/java/com/opensymphony/xwork2/config/entities/ResultConfig.java b/core/src/main/java/com/opensymphony/xwork2/config/entities/ResultConfig.java index 50602636b9..9cb78c0fde 100644 --- a/core/src/main/java/com/opensymphony/xwork2/config/entities/ResultConfig.java +++ b/core/src/main/java/com/opensymphony/xwork2/config/entities/ResultConfig.java @@ -38,7 +38,7 @@ */ public class ResultConfig extends Located implements Serializable { - protected Map params; + protected Map params; protected String className; protected String name; @@ -63,7 +63,7 @@ public String getName() { return name; } - public Map getParams() { + public Map getParams() { return params; } @@ -140,7 +140,7 @@ public Builder addParam(String name, String value) { return this; } - public Builder addParams(Map params) { + public Builder addParams(Map params) { target.params.putAll(params); return this; } diff --git a/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java b/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java index 7c725e15b0..d1560f53f1 100644 --- a/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java +++ b/core/src/main/java/com/opensymphony/xwork2/config/impl/DefaultConfiguration.java @@ -66,7 +66,6 @@ import com.opensymphony.xwork2.factory.ConverterFactory; import com.opensymphony.xwork2.factory.DefaultActionFactory; import com.opensymphony.xwork2.factory.DefaultInterceptorFactory; -import com.opensymphony.xwork2.factory.DefaultResultFactory; import com.opensymphony.xwork2.factory.DefaultUnknownHandlerFactory; import com.opensymphony.xwork2.factory.DefaultValidatorFactory; import com.opensymphony.xwork2.factory.InterceptorFactory; @@ -109,6 +108,7 @@ import org.apache.struts2.conversion.StrutsConversionPropertiesProcessor; import org.apache.struts2.conversion.StrutsTypeConverterCreator; import org.apache.struts2.conversion.StrutsTypeConverterHolder; +import org.apache.struts2.factory.StrutsResultFactory; import org.apache.struts2.ognl.OgnlGuard; import org.apache.struts2.ognl.ProviderAllowlist; import org.apache.struts2.ognl.StrutsOgnlGuard; @@ -363,7 +363,7 @@ public static ContainerBuilder bootstrapFactories(ContainerBuilder builder) { // TODO: SpringObjectFactoryTest fails when these are SINGLETON .factory(ObjectFactory.class, Scope.PROTOTYPE) .factory(ActionFactory.class, DefaultActionFactory.class, Scope.PROTOTYPE) - .factory(ResultFactory.class, DefaultResultFactory.class, Scope.PROTOTYPE) + .factory(ResultFactory.class, StrutsResultFactory.class, Scope.PROTOTYPE) .factory(InterceptorFactory.class, DefaultInterceptorFactory.class, Scope.PROTOTYPE) .factory(ValidatorFactory.class, DefaultValidatorFactory.class, Scope.PROTOTYPE) .factory(ConverterFactory.class, StrutsConverterFactory.class, Scope.PROTOTYPE) diff --git a/core/src/main/java/com/opensymphony/xwork2/factory/DefaultResultFactory.java b/core/src/main/java/com/opensymphony/xwork2/factory/DefaultResultFactory.java index 42527494e1..b4e312bfd8 100644 --- a/core/src/main/java/com/opensymphony/xwork2/factory/DefaultResultFactory.java +++ b/core/src/main/java/com/opensymphony/xwork2/factory/DefaultResultFactory.java @@ -26,12 +26,16 @@ import com.opensymphony.xwork2.util.reflection.ReflectionException; import com.opensymphony.xwork2.util.reflection.ReflectionExceptionHandler; import com.opensymphony.xwork2.util.reflection.ReflectionProvider; +import org.apache.struts2.factory.StrutsResultFactory; import java.util.Map; /** * Default implementation + * + * @deprecated since 6.7.0, use {@link StrutsResultFactory} instead. */ +@Deprecated public class DefaultResultFactory implements ResultFactory { private ObjectFactory objectFactory; diff --git a/core/src/test/java/com/opensymphony/xwork2/interceptor/ChainingInterceptorWithConfigTest.java b/core/src/test/java/com/opensymphony/xwork2/interceptor/ChainingInterceptorWithConfigTest.java index ab1bfbf5f7..41e5a2c07d 100644 --- a/core/src/test/java/com/opensymphony/xwork2/interceptor/ChainingInterceptorWithConfigTest.java +++ b/core/src/test/java/com/opensymphony/xwork2/interceptor/ChainingInterceptorWithConfigTest.java @@ -42,6 +42,7 @@ import java.util.Collections; import java.util.HashMap; +import java.util.Map; /** @@ -101,11 +102,11 @@ public void loadPackages() throws ConfigurationException { HashMap interceptorParams = new HashMap<>(); interceptorParams.put("excludes", "blah,bar"); - HashMap successParams1 = new HashMap(); + Map successParams1 = new HashMap<>(); successParams1.put("propertyName", "baz"); - successParams1.put("expectedValue", 1); + successParams1.put("expectedValue", "1"); - HashMap successParams2 = new HashMap(); + Map successParams2 = new HashMap<>(); successParams2.put("propertyName", "blah"); successParams2.put("expectedValue", null); diff --git a/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java b/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java index 1643ce7ae5..b6a9de4bee 100644 --- a/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java +++ b/plugins/convention/src/test/java/org/apache/struts2/convention/PackageBasedActionConfigBuilderTest.java @@ -35,7 +35,6 @@ import com.opensymphony.xwork2.config.entities.ResultTypeConfig; import com.opensymphony.xwork2.config.impl.DefaultConfiguration; import com.opensymphony.xwork2.factory.DefaultInterceptorFactory; -import com.opensymphony.xwork2.factory.DefaultResultFactory; import com.opensymphony.xwork2.inject.Container; import com.opensymphony.xwork2.inject.Scope.Strategy; import com.opensymphony.xwork2.ognl.OgnlReflectionProvider; @@ -97,6 +96,7 @@ import org.apache.struts2.convention.annotation.Action; import org.apache.struts2.convention.annotation.Actions; import org.apache.struts2.convention.dontfind.DontFindMeAction; +import org.apache.struts2.factory.StrutsResultFactory; import org.apache.struts2.ognl.ProviderAllowlist; import org.apache.struts2.result.ServletDispatcherResult; import org.easymock.EasyMock; @@ -918,7 +918,7 @@ public void setProperty(String name, Object value, Object o, Map dif.setObjectFactory((ObjectFactory) obj); dif.setReflectionProvider(rp); - DefaultResultFactory drf = new DefaultResultFactory(); + StrutsResultFactory drf = new StrutsResultFactory(); drf.setObjectFactory((ObjectFactory) obj); drf.setReflectionProvider(rp);