Hao Zhong created WW-5106:
-----------------------------
Summary: The call chains of ActionContext.getContext() in
ServletActionContext are dangerious
Key: WW-5106
URL: https://issues.apache.org/jira/browse/WW-5106
Project: Struts 2
Issue Type: Bug
Reporter: Hao Zhong
The ServletActionContext class has many call chains of
ActionContext.getContext():
{code:java}
public static ActionMapping getActionMapping() {
return ActionContext.getContext().getActionMapping();
}
public static PageContext getPageContext() {
return ActionContext.getContext().getPageContext();
}
public static PageContext getPageContext() {
return ActionContext.getContext().getPageContext();
}
{code}
ActionContext.getContext() can return null values. A previous bug was caused by
the its null values. https://issues.apache.org/jira/browse/WW-3637
The patch of WW-3637 is as follows:
private static void reloadBundles() {
- reloadBundles(ActionContext.getContext().getContextMap());
+ reloadBundles(ActionContext.getContext() != null ?
ActionContext.getContext().getContextMap() : null);
}
Either the implementation of ActionContext.getContext() or its call sites shall
be revised.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)