You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openjpa.apache.org by "Chad Patras (JIRA)" <ji...@apache.org> on 2007/11/19 22:31:43 UTC

[jira] Commented: (OPENJPA-336) PCEnhancer throws an NPE when run with DefaultAccessType=PROPERTY on a MappedSuperclass

    [ 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.