DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30759>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30759

[Patch] Problem with id attribute, caused NullPointerException

           Summary: [Patch] Problem with id attribute, caused
                    NullPointerException
           Product: Commons
           Version: 1.0 Beta 1
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Betwixt
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
                CC: [EMAIL PROTECTED]


we had code like:

  in the bean:
    private Integer id = null;
    public Integer getId() { return this.id; }
  in the dot-betwixt file:
    <attribute name="id" property="id"/> 

and refactored our bean, so it became:

  private Integer productId = null;
  public Integer getProductId { return this.productId; }

we forgot to change the dot-betwixt file, thus betwixt came up with a
NullPointerException (attached at the bottom).
We spent some hours <:-( debugging this, because we did't thought that it's
about the forgotten change in the dot-betwixt file, sometimes I'm such an 
idiot. So it would be nice to have an exception that makes it a little bit
clearer, what the problem could be, instead just having a NullPointerException.
So, here is my patch to the AbstractBeanWriter to do so, peheaps this is not the
perfect place to fix this, but it works.

regards
Christoph Gaffga
[EMAIL PROTECTED]


I attached the patch to this bug report.

See the NullPointerException below, wouldn't happen with the patch version.

java.lang.NullPointerException
       at
org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(AbstractBeanWriter.java:289)
       at
org.apache.commons.betwixt.io.AbstractBeanWriter.writeElementContent(AbstractBeanWriter.java:834)
       at
org.apache.commons.betwixt.io.AbstractBeanWriter.writeElement(AbstractBeanWriter.java:637)
       at
org.apache.commons.betwixt.io.AbstractBeanWriter.writeElementContent(AbstractBeanWriter.java:851)
       at
org.apache.commons.betwixt.io.AbstractBeanWriter.writeElement(AbstractBeanWriter.java:637)
       at
org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean(AbstractBeanWriter.java:302)
       at
org.apache.commons.betwixt.io.AbstractBeanWriter.write(AbstractBeanWriter.java:155)
       at
org.apache.commons.betwixt.io.BeanWriter.write(BeanWriter.java:190)
       at
com.triplemind.test.TestBetwixt.main(TestBetwixt.java:41)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to