(struts) branch feature/jakarta-modules updated (26bb35e6c -> daf5b5055)

2023-12-30 Thread lukaszlenart
This is an automated email from the ASF dual-hosted git repository.

lukaszlenart pushed a change to branch feature/jakarta-modules
in repository https://gitbox.apache.org/repos/asf/struts.git


from 26bb35e6c Moves JakartaEE related modules into dedicate subdirectory
 add daf5b5055 Fixes typo in pom

No new revisions were added by this update.

Summary of changes:
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)



(struts) 01/03: WW-5382 Fix StrutsInternalTestCase

2023-12-30 Thread kusal
This is an automated email from the ASF dual-hosted git repository.

kusal pushed a commit to branch WW-5382-stale-config
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 32584c355112bbdb9a89b6b12984b8d989ba77cf
Author: Kusal Kithul-Godage 
AuthorDate: Sat Dec 30 23:55:12 2023 +1100

WW-5382 Fix StrutsInternalTestCase
---
 .../org/apache/struts2/StrutsInternalTestCase.java  | 21 +++--
 .../org/apache/struts2/config/SettingsTest.java |  2 +-
 core/src/test/resources/struts.properties   |  2 +-
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/core/src/test/java/org/apache/struts2/StrutsInternalTestCase.java 
b/core/src/test/java/org/apache/struts2/StrutsInternalTestCase.java
index 30616303f..5aad82969 100644
--- a/core/src/test/java/org/apache/struts2/StrutsInternalTestCase.java
+++ b/core/src/test/java/org/apache/struts2/StrutsInternalTestCase.java
@@ -18,12 +18,14 @@
  */
 package org.apache.struts2;
 
+import com.opensymphony.xwork2.ActionProxyFactory;
 import com.opensymphony.xwork2.XWorkTestCase;
 import org.apache.commons.lang3.builder.EqualsBuilder;
 import org.apache.struts2.dispatcher.Dispatcher;
 import org.apache.struts2.dispatcher.PrepareOperations;
 import org.apache.struts2.util.StrutsTestCaseHelper;
 import org.apache.struts2.views.jsp.StrutsMockServletContext;
+
 import java.util.HashMap;
 import java.util.Map;
 
@@ -38,22 +40,22 @@ public abstract class StrutsInternalTestCase extends 
XWorkTestCase {
 /**
  * Sets up the configuration settings, XWork configuration, and
  * message resources
- * 
+ *
  * @throws java.lang.Exception
  */
 @Override
 protected void setUp() throws Exception {
-super.setUp();
 PrepareOperations.clearDevModeOverride();  // Clear DevMode override 
every time (consistent ThreadLocal state for tests).
 initDispatcher(null);
 }
-
+
 protected Dispatcher initDispatcher(Map params) {
 servletContext = new StrutsMockServletContext();
 dispatcher = StrutsTestCaseHelper.initDispatcher(servletContext, 
params);
 configurationManager = dispatcher.getConfigurationManager();
 configuration = configurationManager.getConfiguration();
 container = configuration.getContainer();
+actionProxyFactory = container.getInstance(ActionProxyFactory.class);
 container.inject(dispatcher);
 return dispatcher;
 }
@@ -66,14 +68,13 @@ public abstract class StrutsInternalTestCase extends 
XWorkTestCase {
  * @return instance of {@see Dispatcher}
  */
 protected Dispatcher initDispatcherWithConfigs(String configs) {
-Map params = new HashMap();
+Map params = new HashMap<>();
 params.put("config", configs);
 return initDispatcher(params);
 }
 
 @Override
 protected void tearDown() throws Exception {
-super.tearDown();
 // maybe someone else already destroyed Dispatcher
 if (dispatcher != null && dispatcher.getConfigurationManager() != 
null) {
 dispatcher.cleanup();
@@ -83,14 +84,14 @@ public abstract class StrutsInternalTestCase extends 
XWorkTestCase {
 }
 
 /**
- * Compare if two objects are considered equal according to their fields 
as accessed 
+ * Compare if two objects are considered equal according to their fields 
as accessed
  * via reflection.
- * 
- * Utilizes {@link EqualsBuilder#reflectionEquals(java.lang.Object, 
java.lang.Object, boolean)} to perform 
+ *
+ * Utilizes {@link EqualsBuilder#reflectionEquals(java.lang.Object, 
java.lang.Object, boolean)} to perform
  * the check, and compares transient fields as well.  This may fail when 
run while a security manager is
  * active, due to a need to user reflection.
- * 
- * 
+ *
+ *
  * @param obj1 the first {@link Object} to compare against the other.
  * @param obj2 the second {@link Object} to compare against the other.
  * @return true if the objects are equal based on field comparisons by 
reflection, false otherwise.
diff --git a/core/src/test/java/org/apache/struts2/config/SettingsTest.java 
b/core/src/test/java/org/apache/struts2/config/SettingsTest.java
index c31a53adb..90b824ae4 100644
--- a/core/src/test/java/org/apache/struts2/config/SettingsTest.java
+++ b/core/src/test/java/org/apache/struts2/config/SettingsTest.java
@@ -36,7 +36,7 @@ public class SettingsTest extends StrutsInternalTestCase {
 Settings settings = new DefaultSettings();
 
 assertEquals("12345", 
settings.get(StrutsConstants.STRUTS_MULTIPART_MAXSIZE));
-assertEquals("\temp", 
settings.get(StrutsConstants.STRUTS_MULTIPART_SAVEDIR));
+assertEquals("\\temp", 
settings.get(StrutsConstants.STRUTS_MULTIPART_SAVEDIR));
 
 assertEquals("test,org/apache/struts2/othertest", settings.get( 
StrutsConstants.STRUTS_CUSTOM_PROPERTIES));
 assertEquals("testva

(struts) branch WW-5382-stale-config created (now 2024d8317)

2023-12-30 Thread kusal
This is an automated email from the ASF dual-hosted git repository.

kusal pushed a change to branch WW-5382-stale-config
in repository https://gitbox.apache.org/repos/asf/struts.git


  at 2024d8317 WW-5382 Fix stale bootstrap context on ActionContext

This branch includes the following new commits:

 new 32584c355 WW-5382 Fix StrutsInternalTestCase
 new 15acd72d2 WW-5382 Fix stale injections in Dispatcher
 new 2024d8317 WW-5382 Fix stale bootstrap context on ActionContext

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.




(struts) 03/03: WW-5382 Fix stale bootstrap context on ActionContext

2023-12-30 Thread kusal
This is an automated email from the ASF dual-hosted git repository.

kusal pushed a commit to branch WW-5382-stale-config
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 2024d831772a8ce19cd915671a7d570762135ec9
Author: Kusal Kithul-Godage 
AuthorDate: Sun Dec 31 00:30:15 2023 +1100

WW-5382 Fix stale bootstrap context on ActionContext
---
 .../com/opensymphony/xwork2/config/impl/DefaultConfiguration.java | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)

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 4a6ee1373..3c60af76c 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
@@ -325,12 +325,8 @@ public class DefaultConfiguration implements Configuration 
{
 }
 
 protected ActionContext setContext(Container cont) {
-ActionContext context = ActionContext.getContext();
-if (context == null) {
-ValueStack vs = 
cont.getInstance(ValueStackFactory.class).createValueStack();
-context = ActionContext.of(vs.getContext()).bind();
-}
-return context;
+ValueStack vs = 
cont.getInstance(ValueStackFactory.class).createValueStack();
+return ActionContext.of(vs.getContext()).bind();
 }
 
 protected Container createBootstrapContainer(List 
providers) {



(struts) 02/03: WW-5382 Fix stale injections in Dispatcher

2023-12-30 Thread kusal
This is an automated email from the ASF dual-hosted git repository.

kusal pushed a commit to branch WW-5382-stale-config
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 15acd72d240f356685ab2238a0ab4e62130c84ae
Author: Kusal Kithul-Godage 
AuthorDate: Sun Dec 31 00:29:29 2023 +1100

WW-5382 Fix stale injections in Dispatcher
---
 .../org/apache/struts2/dispatcher/Dispatcher.java  | 47 +-
 .../apache/struts2/dispatcher/MockDispatcher.java  | 19 -
 2 files changed, 37 insertions(+), 29 deletions(-)

diff --git a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java 
b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
index e378633e2..7234dfe6c 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java
@@ -119,6 +119,8 @@ public class Dispatcher {
  */
 private static final List dispatcherListeners = new 
CopyOnWriteArrayList<>();
 
+private Container injectedContainer;
+
 /**
  * Store state of StrutsConstants.STRUTS_DEVMODE setting.
  */
@@ -331,6 +333,12 @@ public class Dispatcher {
 this.handleException = Boolean.parseBoolean(handleException);
 }
 
+@Inject(StrutsConstants.STRUTS_DISPATCHER_PARAMETERSWORKAROUND)
+public void setDispatchersParametersWorkaround(String 
dispatchersParametersWorkaround) {
+this.paramsWorkaroundEnabled = 
Boolean.parseBoolean(dispatchersParametersWorkaround)
+|| (servletContext != null && 
StringUtils.contains(servletContext.getServerInfo(), "WebLogic"));
+}
+
 public boolean isHandleException() {
 return handleException;
 }
@@ -536,17 +544,6 @@ public class Dispatcher {
 return getContainer();
 }
 
-private void init_CheckWebLogicWorkaround(Container container) {
-// test whether param-access workaround needs to be enabled
-if (servletContext != null && 
StringUtils.contains(servletContext.getServerInfo(), "WebLogic")) {
-LOG.info("WebLogic server detected. Enabling Struts parameter 
access work-around.");
-paramsWorkaroundEnabled = true;
-} else {
-paramsWorkaroundEnabled = 
"true".equals(container.getInstance(String.class,
-StrutsConstants.STRUTS_DISPATCHER_PARAMETERSWORKAROUND));
-}
-}
-
 /**
  * Load configurations, including both XML and zero-configuration 
strategies,
  * and update optional settings, including whether to reload 
configurations and resource files.
@@ -567,9 +564,7 @@ public class Dispatcher {
 init_AliasStandardObjects(); // [7]
 init_DeferredXmlConfigurations();
 
-Container container = init_PreloadConfiguration();
-container.inject(this);
-init_CheckWebLogicWorkaround(container);
+getContainer(); // Inject this instance
 
 if (!dispatcherListeners.isEmpty()) {
 for (DispatcherListener l : dispatcherListeners) {
@@ -1068,22 +1063,18 @@ public class Dispatcher {
  * @return Our dependency injection container
  */
 public Container getContainer() {
-if (ContainerHolder.get() != null) {
-return ContainerHolder.get();
-}
-ConfigurationManager mgr = getConfigurationManager();
-if (mgr == null) {
-throw new IllegalStateException("The configuration manager 
shouldn't be null");
-} else {
-Configuration config = mgr.getConfiguration();
-if (config == null) {
-throw new IllegalStateException("Unable to load 
configuration");
-} else {
-Container container = config.getContainer();
-ContainerHolder.store(container);
-return container;
+if (ContainerHolder.get() == null) {
+try {
+
ContainerHolder.store(getConfigurationManager().getConfiguration().getContainer());
+} catch (NullPointerException e) {
+throw new IllegalStateException("ConfigurationManager and/or 
Configuration should not be null", e);
 }
 }
+if (injectedContainer != ContainerHolder.get()) {
+injectedContainer = ContainerHolder.get();
+injectedContainer.inject(this);
+}
+return ContainerHolder.get();
 }
 
 }
diff --git 
a/core/src/main/java/org/apache/struts2/dispatcher/MockDispatcher.java 
b/core/src/main/java/org/apache/struts2/dispatcher/MockDispatcher.java
index b10014995..500e1b541 100644
--- a/core/src/main/java/org/apache/struts2/dispatcher/MockDispatcher.java
+++ b/core/src/main/java/org/apache/struts2/dispatcher/MockDispatcher.java
@@ -19,14 +19,19 @@
 package org.apache.struts2.dispatcher;
 
 import com.opensymphony.xwork2.config.ConfigurationManager;
+import com.opensymphony.xwork2.inject.Container;
 
 import javax.serv