struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hudson (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-3822) Struts 2 and Generic Class - Null Pointer Exception
Date Mon, 23 Jul 2012 13:47:35 GMT

    [ https://issues.apache.org/jira/browse/WW-3822?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13420657#comment-13420657
] 

Hudson commented on WW-3822:
----------------------------

Integrated in Struts2 #507 (See [https://builds.apache.org/job/Struts2/507/])
    WW-3822 adds check if setter was defined as this can be read-only property (Revision 1364624)

     Result = SUCCESS
lukaszlenart : 
Files : 
* /struts/struts2/trunk/xwork-core/src/main/java/com/opensymphony/xwork2/conversion/impl/DefaultObjectTypeDeterminer.java

                
> Struts 2 and Generic Class - Null Pointer Exception
> ---------------------------------------------------
>
>                 Key: WW-3822
>                 URL: https://issues.apache.org/jira/browse/WW-3822
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Actions
>    Affects Versions: 2.3.1.1
>         Environment: Windows 7 - Java 6 - Tomcat 7
>            Reporter: Daniel Matthews-Grout
>            Assignee: Lukasz Lenart
>            Priority: Minor
>             Fix For: 2.3.5
>
>
> I have a class that extends a generic abstract class and types that generic - e.g.
> class MyClass extends AbstractClass<Integer> ..
> class AbstractClass<ID extends Serializable> {
>    public abstract ID getId();
> }
> JSP:
> <s:property value="myClass.id"/>
> The abstract class defined an abstract getter that I implemented in the concrete class.
 I then referenced this getter in the JSP of a Struts 2 action and got the following:
> java.lang.NullPointerException
>  at com.opensymphony.xwork2.conversion.impl.DefaultObjectTypeDeterminer.getClass(DefaultObjectTypeDeterminer.java:314)
>  at com.opensymphony.xwork2.conversion.impl.DefaultObjectTypeDeterminer.getKeyClass(DefaultObjectTypeDeterminer.java:93)
>  at com.opensymphony.xwork2.ognl.accessor.XWorkMapPropertyAccessor.getProperty(XWorkMapPropertyAccessor.java:93)
>  at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:2303)
>  at ognl.ASTProperty.getValueBody(ASTProperty.java:114)
>  at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
>  at ognl.SimpleNode.getValue(SimpleNode.java:258)
>  at ognl.ASTChain.getValueBody(ASTChain.java:141)
>  at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:212)
>  at ognl.SimpleNode.getValue(SimpleNode.java:258)
>  at ognl.Ognl.getValue(Ognl.java:494)
>  at ognl.Ognl.getValue(Ognl.java:458)
> ....
> So what I had to do was to add a another get/set pair in the concrete class that updated/read
from the same field.  This stopped the error.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message