commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bradley M. Handy" <brad.ha...@williamstonfmc.org>
Subject Re: [betwixt] NPE while using BeanWriter.setWriteEmptyElements() to "false"
Date Sat, 07 Jun 2003 04:36:18 GMT
Here is the test case I said I would submit.  I'm not very good at writing 
test cases, but I'm hope I give you what you need.

The attached classes are:

org.apache.commons.betwixt.io.BeanWriterTest
org.apache.commons.betwixt.CreditCard
org.apache.commons.betwixt.CreditCardWithDotBetwixt
org.apache.commons.betwixt.PersonBeanWithBotBetwixt

also 2 ".betwixt" files are attached.

Two things I have found out:
(1)  If I don't create a ".betwixt" file, then there is no exception.  But, 
once I create a ".betwixt" file then I get the NPE.
(2) I don't get an NPE at all when using 
org.apache.commons.betwixt.PersonBean as the test bean (with or w/o a 
".betwixt" file).

Brad Handy

At 05:04 PM 6/5/2003, you wrote:
>hi bradley
>
>i've added a check for null into XMLIntrospectorHelper. so if you build 
>from CVS HEAD, that particular problem will mostly likely go away. on the 
>other hand. i strongly suspect that this is a symptom rather than the 
>actual problem. what i would find very useful would be a test case 
>(preferably one which you're willing to donate to the ASF) that 
>demonstrates this problem. then i'll be able to run the code on my machine 
>and work out whether it's a bug in betwixt or some other issue.
>
>- robert
>
>On Thursday, June 5, 2003, at 04:35 PM, Bradley M. Handy wrote:
>
>>I get the following NPE when setting "writeEmptyElements" property of 
>>"BeanWriter" to false.
>>
>>Is there something I'm not doing properly.  I've got my ".betwixt" files 
>>defined properly, because when the property is set to "true" the test app 
>>runs fine.
>>
>>I'm using the source from the CVS repository as of 5:00pm -0500 on June 4th.
>>
>>java.lang.NullPointerException
>>         at 
>> org.apache.commons.betwixt.digester.XMLIntrospectorHelper.isLoopType
>>(XMLIntrospectorHelper.java:575)
>>         at org.apache.commons.betwixt.io.AbstractBeanWriter.isEmptyElement
>>(AbstractBeanWriter.java:856)
>>         at org.apache.commons.betwixt.io.AbstractBeanWriter.ignoreElement(
>>AbstractBeanWriter.java:814)
>>         at org.apache.commons.betwixt.io.AbstractBeanWriter.writeElement(
>>AbstractBeanWriter.java:536)
>>         at org.apache.commons.betwixt.io.AbstractBeanWriter.writeBean
>>(AbstractBeanWriter.java:282)
>>         at 
>> org.apache.commons.betwixt.io.AbstractBeanWriter.write(AbstractBeanWriter.
>>java:193)
>>         at 
>> org.apache.commons.betwixt.io.AbstractBeanWriter.write(AbstractBeanWriter.
>>java:164)
>>         at org.apache.commons.betwixt.io.BeanWriter.write(BeanWriter.java:
>>231)
>>         at BetwixtTest.main(BetwixtTest.java:44)
>>Exception in thread "main"
>>
>>
>>Brad
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: commons-user-help@jakarta.apache.org

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