mirror of
https://github.com/apache/struts.git
synced 2026-08-06 07:06:58 +00:00
Merge pull request #328 from aleksandr-m/feature/WW-5009
WW-5009 EmptyStackException in JSON plugin due to concurrency
This commit is contained in:
@@ -71,13 +71,6 @@ 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();
|
||||
@@ -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);
|
||||
|
||||
@@ -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 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);
|
||||
@@ -272,9 +254,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);
|
||||
|
||||
Reference in New Issue
Block a user