openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chad Patras (JIRA)" <j...@apache.org>
Subject [jira] Commented: (OPENJPA-336) PCEnhancer throws an NPE when run with DefaultAccessType=PROPERTY on a MappedSuperclass
Date Mon, 19 Nov 2007 21:31:43 GMT

    [ https://issues.apache.org/jira/browse/OPENJPA-336?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12543698
] 

Chad Patras commented on OPENJPA-336:
-------------------------------------

The same issue occurs when a mapped class has no field of the same data type matching the
property accessor.  For example.

public class AWrapper
{
	private StringBuffer myString = new StringBuffer();
	
	public void setMyString(String string) {
		myString.setLength(0);
		myString.append(string);
	}
	
	public String getMyString() {
		return myString.toString();
	}
	
}

> PCEnhancer throws an NPE when run with DefaultAccessType=PROPERTY on a MappedSuperclass
> ---------------------------------------------------------------------------------------
>
>                 Key: OPENJPA-336
>                 URL: https://issues.apache.org/jira/browse/OPENJPA-336
>             Project: OpenJPA
>          Issue Type: Bug
>          Components: kernel
>    Affects Versions: 1.0.0
>            Reporter: Marc Prud'hommeaux
>
> With the following class:
> package test;
> import javax.persistence.*;
> @MappedSuperclass public abstract class MyMappedSuperclass {
>     public void doSometing() { }
> }
> Running the PCEnhancer with DefaultAccessType=PROPERTY as follows:
> java org.apache.openjpa.enhance.PCEnhancer -MetaDataFactory 'jpa(DefaultAccessType=PROPERTY)'
-Log DefaultLevel=TRACE test.MyMappedSuperclass
> Causes an NPE:
> Exception in thread "main" <openjpa-1.0.0-r420667:568385 nonfatal general error>
org.apache.openjpa.util.GeneralException: null
>         at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:470)
>         at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4342)
>         at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4284)
>         at org.apache.openjpa.enhance.PCEnhancer.main(PCEnhancer.java:4256)
> Caused by: java.lang.NullPointerException
>         at org.apache.openjpa.enhance.PCEnhancer.toBackingFieldName(PCEnhancer.java:3664)
>         at org.apache.openjpa.enhance.PCEnhancer.getfield(PCEnhancer.java:3578)
>         at org.apache.openjpa.enhance.PCEnhancer.addDetachedStateMethods(PCEnhancer.java:3540)
>         at org.apache.openjpa.enhance.PCEnhancer.addAttachDetachCode(PCEnhancer.java:3492)
>         at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:457)
>         ... 3 more

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message