[ 
https://issues.apache.org/jira/browse/WW-5006?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Sebastian Götz updated WW-5006:
-------------------------------
    Description: 
In some JSP we access static fields (constants) of an interface. The interface 
has scope public and and the fields are public static final.

When accessing the value of such a field the ValueStack throws a 
NullPointerException here (com.opensymphony.xwork2.util.ProxyUtil), because 
there is actually no object (parameter holds null) when accessing a static 
member:
{code:java}
/**
* Check whether the given object is a proxy.
* @param object the object to check
*/
public static boolean isProxy(Object object) {
Class<?> clazz = object.getClass();
Boolean flag = isProxyCache.get(clazz);
if (flag != null) {
return flag;
}

boolean isProxy = isSpringAopProxy(object);

isProxyCache.put(clazz, isProxy);
return isProxy;
}

{code}
 

Support to access static members is switched on via struts constant 

{{<constant name="struts.ognl.allowStaticMethodAccess" value="true" />}}

  was:
In some JSP we access static field (constants) of an interface. The interface 
has scope public and and the fields are public static final.

When accessing the value of such a field the ValueStack throws a 
NullPointerException here (com.opensymphony.xwork2.util.ProxyUtil), because 
there is actually not object (parameter holds null) when accessing a static 
member:
{code:java}
/**
* Check whether the given object is a proxy.
* @param object the object to check
*/
public static boolean isProxy(Object object) {
Class<?> clazz = object.getClass();
Boolean flag = isProxyCache.get(clazz);
if (flag != null) {
return flag;
}

boolean isProxy = isSpringAopProxy(object);

isProxyCache.put(clazz, isProxy);
return isProxy;
}

{code}
 

Support to access static members is switched on via struts constant 

{{<constant name="struts.ognl.allowStaticMethodAccess" value="true" />}}


> NullPointerException in ProxyUtil class when accessing static member
> --------------------------------------------------------------------
>
>                 Key: WW-5006
>                 URL: https://issues.apache.org/jira/browse/WW-5006
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Value Stack
>    Affects Versions: 2.5.20
>            Reporter: Sebastian Götz
>            Priority: Major
>             Fix For: 2.5.21, 2.6
>
>
> In some JSP we access static fields (constants) of an interface. The 
> interface has scope public and and the fields are public static final.
> When accessing the value of such a field the ValueStack throws a 
> NullPointerException here (com.opensymphony.xwork2.util.ProxyUtil), because 
> there is actually no object (parameter holds null) when accessing a static 
> member:
> {code:java}
> /**
> * Check whether the given object is a proxy.
> * @param object the object to check
> */
> public static boolean isProxy(Object object) {
> Class<?> clazz = object.getClass();
> Boolean flag = isProxyCache.get(clazz);
> if (flag != null) {
> return flag;
> }
> boolean isProxy = isSpringAopProxy(object);
> isProxyCache.put(clazz, isProxy);
> return isProxy;
> }
> {code}
>  
> Support to access static members is switched on via struts constant 
> {{<constant name="struts.ognl.allowStaticMethodAccess" value="true" />}}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to