[struts] branch struts-2-5-x updated (32e88d1 -> fdd1054)

2019-02-05 Thread yasserzamani
This is an automated email from the ASF dual-hosted git repository.

yasserzamani pushed a change to branch struts-2-5-x
in repository https://gitbox.apache.org/repos/asf/struts.git.


from 32e88d1  Merge pull request #322 from aleksandr-m/feature/WW-4991
 new 0323795  WW-5009 EmptyStackException in JSON plugin due to concurrency
 new 7242a87  WW-5009 Fix tests
 new fdd1054  Merge pull request #328 from aleksandr-m/feature/WW-5009

The 5374 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.


Summary of changes:
 .../org/apache/struts2/json/JSONInterceptor.java|  9 ++---
 .../apache/struts2/json/JSONInterceptorTest.java| 21 -
 2 files changed, 2 insertions(+), 28 deletions(-)



[struts] branch master updated: WW-5009 EmptyStackException in JSON plugin due to concurrency

2019-02-05 Thread yasserzamani
This is an automated email from the ASF dual-hosted git repository.

yasserzamani pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/struts.git


The following commit(s) were added to refs/heads/master by this push:
 new be457f4  WW-5009 EmptyStackException in JSON plugin due to concurrency
 new f3fb36b  Merge pull request #329 from 
aleksandr-m/feature/WW-5009_master
be457f4 is described below

commit be457f4241418b75cdcf0a9b71775dde91f94163
Author: Aleksandr Mashchenko 
AuthorDate: Sun Feb 3 21:41:08 2019 +0200

WW-5009 EmptyStackException in JSON plugin due to concurrency
---
 .../org/apache/struts2/json/JSONInterceptor.java| 11 +++
 .../apache/struts2/json/JSONInterceptorTest.java| 21 -
 2 files changed, 3 insertions(+), 29 deletions(-)

diff --git 
a/plugins/json/src/main/java/org/apache/struts2/json/JSONInterceptor.java 
b/plugins/json/src/main/java/org/apache/struts2/json/JSONInterceptor.java
index 2c793de..e92620f 100644
--- a/plugins/json/src/main/java/org/apache/struts2/json/JSONInterceptor.java
+++ b/plugins/json/src/main/java/org/apache/struts2/json/JSONInterceptor.java
@@ -71,18 +71,11 @@ public class JSONInterceptor extends AbstractInterceptor {
 private String jsonContentType = "application/json";
 private String jsonRpcContentType = "application/json-rpc";
 
-private JSONUtil jsonUtil;
-
-@Inject
-public void setJsonUtil(JSONUtil jsonUtil) {
-this.jsonUtil = jsonUtil;
-}
-
 @SuppressWarnings("unchecked")
 public String intercept(ActionInvocation invocation) throws Exception {
 HttpServletRequest request = ServletActionContext.getRequest();
 HttpServletResponse response = ServletActionContext.getResponse();
-
+
 String requestContentType = readContentType(request);
 String requestContentTypeEncoding = readContentTypeEncoding(request);
 
@@ -175,6 +168,8 @@ public class JSONInterceptor extends AbstractInterceptor {
 result = rpcResponse;
 }
 
+JSONUtil jsonUtil = 
invocation.getInvocationContext().getContainer().getInstance(JSONUtil.class);
+
 String json = jsonUtil.serialize(result, excludeProperties, 
getIncludeProperties(),
 ignoreHierarchy, excludeNullProperties);
 json = addCallbackIfApplicable(request, json);
diff --git 
a/plugins/json/src/test/java/org/apache/struts2/json/JSONInterceptorTest.java 
b/plugins/json/src/test/java/org/apache/struts2/json/JSONInterceptorTest.java
index dd84927..9f6b76f 100644
--- 
a/plugins/json/src/test/java/org/apache/struts2/json/JSONInterceptorTest.java
+++ 
b/plugins/json/src/test/java/org/apache/struts2/json/JSONInterceptorTest.java
@@ -93,9 +93,6 @@ public class JSONInterceptorTest extends StrutsTestCase {
 this.request.addHeader("Content-Type", "application/json-rpc");
 
 JSONInterceptor interceptor = new JSONInterceptor();
-JSONUtil jsonUtil = new JSONUtil();
-jsonUtil.setWriter(new DefaultJSONWriter());
-interceptor.setJsonUtil(jsonUtil);
 SMDActionTest1 action = new SMDActionTest1();
 
 this.invocation.setAction(action);
@@ -116,9 +113,6 @@ public class JSONInterceptorTest extends StrutsTestCase {
 
 JSONInterceptor interceptor = new JSONInterceptor();
 interceptor.setEnableSMD(true);
-JSONUtil jsonUtil = new JSONUtil();
-jsonUtil.setWriter(new DefaultJSONWriter());
-interceptor.setJsonUtil(jsonUtil);
 SMDActionTest2 action = new SMDActionTest2();
 
 this.invocation.setAction(action);
@@ -137,9 +131,6 @@ public class JSONInterceptorTest extends StrutsTestCase {
 
 JSONInterceptor interceptor = new JSONInterceptor();
 interceptor.setEnableSMD(true);
-JSONUtil jsonUtil = new JSONUtil();
-jsonUtil.setWriter(new DefaultJSONWriter());
-interceptor.setJsonUtil(jsonUtil);
 SMDActionTest2 action = new SMDActionTest2();
 
 this.invocation.setAction(action);
@@ -158,9 +149,6 @@ public class JSONInterceptorTest extends StrutsTestCase {
 
 JSONInterceptor interceptor = new JSONInterceptor();
 interceptor.setEnableSMD(true);
-JSONUtil jsonUtil = new JSONUtil();
-jsonUtil.setWriter(new DefaultJSONWriter());
-interceptor.setJsonUtil(jsonUtil);
 SMDActionTest1 action = new SMDActionTest1();
 
 this.invocation.setAction(action);
@@ -206,9 +194,6 @@ public class JSONInterceptorTest extends StrutsTestCase {
 
 JSONInterceptor interceptor = new JSONInterceptor();
 interceptor.setEnableSMD(true);
-JSONUtil jsonUtil = new JSONUtil();
-jsonUtil.setWriter(new DefaultJSONWriter());
-interceptor.setJsonUtil(jsonUtil);
 SMDActionTest1 action = new SMDActionTest1();
 
 this.invocation.setAction(action);
@@ -244,9 +229,6 @@ public class JSONInterceptorTest exten