openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leake, Stephen" <stephenle...@fairisaac.com>
Subject Bug in Enhancer?
Date Mon, 19 May 2008 13:25:37 GMT
If I have the following class the enhancer will enhance it correctly:

@Entity(name = "TEST")

public class Test {

      

      String name;

      String description;

 

 

      public Test(){

      }

 

      @Basic

      @Column(name = "DESCRIPTION", length = 32)

      public String getDescription() {

            return description;

      }

      

      public void setDescription(String description) {

            this.description = description;

      }

      

      @Id

      @Column(name = "NAME", length = 10)

      public String getLinkTypeCode() {

            return name;

      }

 

      public void setLinkTypeCode(String name) {

            this.name = name;

}

 

}

 

If I change this class to the following the Enhancer will fail with a
NullPointerException:

 

@Entity(name = "TEST")

public class Test {

      

      private ArrayList fieldList = new ArrayList();

 

 

      public Test(){

      }

 

      @Basic

      @Column(name = "DESCRIPTION", length = 32)

      public String getDescription() {

            return (String) fieldList.get(0);

      }

      

      public void setDescription(String description) {

            fieldList.set(0, description);

      }

      

      @Id

      @Column(name = "NAME", length = 10)

      public String getLinkTypeCode() {

            return (String) fieldList.get(1);

      }

 

      public void setLinkTypeCode(String name) {

            fieldList.set(1, name);

      }

 

}

 

Interestingly, if I store just one field in the ArrayList the Enhancer
task will work. Enhancement only fails when more than one field is being
stored in the ArrayList. Enhancement will also fail if I try to store
the second field in a different ArrayList.

 

 

The error generated by the Enhancer task is below

[openjpac] <openjpa-1.0.3-SNAPSHOT-r420667:636088M nonfatal general
error> org.apache.openjpa.util.GeneralException: An error occurred while
enhancing com.test.entity.Test. Exception message: null

 [openjpac] at
org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:471)

 [openjpac] at
org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4362)

 [openjpac] at
org.apache.openjpa.ant.PCEnhancerTask.executeOn(PCEnhancerTask.java:89)

 [openjpac] at
org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:172)

 [openjpac] at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)

 [openjpac] at org.apache.tools.ant.Task.perform(Task.java:364)

 [openjpac] at org.apache.tools.ant.Target.execute(Target.java:341)

 [openjpac] at org.apache.tools.ant.Target.performTasks(Target.java:369)

 [openjpac] at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)

 [openjpac] at
org.apache.tools.ant.Project.executeTarget(Project.java:1185)

 [openjpac] at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecut
or.java:40)

 [openjpac] at
org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTar
gets(EclipseDefaultExecutor.java:32)

 [openjpac] at
org.apache.tools.ant.Project.executeTargets(Project.java:1068)

 [openjpac] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAnt
Runner.java:423)

 [openjpac] at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAn
tRunner.java:137)

 [openjpac] Caused by: java.lang.NullPointerException

 [openjpac] at
org.apache.openjpa.enhance.PCEnhancer.fromBackingFieldName(PCEnhancer.ja
va:3693)

 [openjpac] at
org.apache.openjpa.enhance.PCEnhancer.replaceAndValidateFieldAccess(PCEn
hancer.java:859)

 [openjpac] at
org.apache.openjpa.enhance.PCEnhancer.replaceAndValidateFieldAccess(PCEn
hancer.java:808)

 [openjpac] at
org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:449)

 [openjpac] ... 14 more

 

BUILD FAILED

C:\workspaces\modularitysvn2\com.fairisaac.edm.encore.links\build.xml:15
: <openjpa-1.0.3-SNAPSHOT-r420667:636088M nonfatal general error>
org.apache.openjpa.util.GeneralException: An error occurred while
enhancing com.test.entity.Test. Exception message: null

      at
org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:176)

      at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)

      at org.apache.tools.ant.Task.perform(Task.java:364)

      at org.apache.tools.ant.Target.execute(Target.java:341)

      at org.apache.tools.ant.Target.performTasks(Target.java:369)

      at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)

      at org.apache.tools.ant.Project.executeTarget(Project.java:1185)

      at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecut
or.java:40)

      at
org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTar
gets(EclipseDefaultExecutor.java:32)

      at org.apache.tools.ant.Project.executeTargets(Project.java:1068)

      at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAnt
Runner.java:423)

      at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAn
tRunner.java:137)

Caused by: <openjpa-1.0.3-SNAPSHOT-r420667:636088M nonfatal general
error> org.apache.openjpa.util.GeneralException: An error occurred while
enhancing com.test.entity.Test. Exception message: null

      at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:471)

      at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4362)

      at
org.apache.openjpa.ant.PCEnhancerTask.executeOn(PCEnhancerTask.java:89)

      at
org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:172)

      ... 11 more

Caused by: java.lang.NullPointerException

      at
org.apache.openjpa.enhance.PCEnhancer.fromBackingFieldName(PCEnhancer.ja
va:3693)

      at
org.apache.openjpa.enhance.PCEnhancer.replaceAndValidateFieldAccess(PCEn
hancer.java:859)

      at
org.apache.openjpa.enhance.PCEnhancer.replaceAndValidateFieldAccess(PCEn
hancer.java:808)

      at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:449)

      ... 14 more

--- Nested Exception ---

<openjpa-1.0.3-SNAPSHOT-r420667:636088M nonfatal general error>
org.apache.openjpa.util.GeneralException: An error occurred while
enhancing com.test.entity.Test. Exception message: null

      at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:471)

      at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:4362)

      at
org.apache.openjpa.ant.PCEnhancerTask.executeOn(PCEnhancerTask.java:89)

      at
org.apache.openjpa.lib.ant.AbstractTask.execute(AbstractTask.java:172)

      at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)

      at org.apache.tools.ant.Task.perform(Task.java:364)

      at org.apache.tools.ant.Target.execute(Target.java:341)

      at org.apache.tools.ant.Target.performTasks(Target.java:369)

      at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)

      at org.apache.tools.ant.Project.executeTarget(Project.java:1185)

      at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecut
or.java:40)

      at
org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTar
gets(EclipseDefaultExecutor.java:32)

      at org.apache.tools.ant.Project.executeTargets(Project.java:1068)

      at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAnt
Runner.java:423)

      at
org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAn
tRunner.java:137)

Caused by: java.lang.NullPointerException

      at
org.apache.openjpa.enhance.PCEnhancer.fromBackingFieldName(PCEnhancer.ja
va:3693)

      at
org.apache.openjpa.enhance.PCEnhancer.replaceAndValidateFieldAccess(PCEn
hancer.java:859)

      at
org.apache.openjpa.enhance.PCEnhancer.replaceAndValidateFieldAccess(PCEn
hancer.java:808)

      at org.apache.openjpa.enhance.PCEnhancer.run(PCEnhancer.java:449)

      ... 14 more


This email and any files transmitted with it are confidential, proprietary
and intended solely for the individual or entity to whom they are addressed.
If you have received this email in error please delete it immediately.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message