Guys,

I have an entity that I decided to munge up a little bit... So,
normally, a setter would be coded like this -

public void setFoo(String foo) {
    this.foo = foo;
}

But, we decided to try to uppercase everything before it goes into the
database. Now the relevant section of code looks like this -

[code]
private String foo;

@Column(length=32)
public String getFoo() {
    return foo;
}

public void setFoo(String foo) {
    this.foo = (foo == null ? null : foo.toUppsercase()) ;
}
[/code]

Our build process enhances the entities (using the ant task which
maven calls during the process-classes phase). Then, it unit tests
them, and right away, every entity that we tried to do this with
bombed out. There was an NPE in pcsetEntityName. The relevant portion
of the stack trace is below -

Caused by: java.lang.NullPointerException
at com.cdotech.amarg.entities.CDO_CageCode.pcsetCageCode(CDO_CageCode.java:55)
at com.cdotech.amarg.entities.CDO_CageCode.pcClearFields(CDO_CageCode.java)
at com.cdotech.amarg.entities.CDO_CageCode.pcNewInstance(CDO_CageCode.java)
at 
org.apache.openjpa.kernel.SaveFieldManager.saveField(SaveFieldManager.java:132)
at org.apache.openjpa.kernel.StateManag

I tried to look through the PCEnhancer, but I'm not familiar enough to
be effective figuring out the problem. At the same time, since the NPE
happens in the generated byte-code, it's *really* hard to figure out
what's going on. I'd like to provide more information, but this is as
much as I can see.

For right now, we moved the capitalizing logic out of the entity, but
was wondering if there is a way to move it back to the entity...

-Wes

-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

Reply via email to