Stephen,

can you please create a new issue for this problem (or add it to an existing 
one), and I am sure somebody will look into this soon. Thanks for your time and 
efforts in helping us tracking this down.

Werner

-----Ursprüngliche Nachricht-----
Von: Stephen Bash [mailto:[EMAIL PROTECTED]
Gesendet: Dienstag, 16. August 2005 16:42
An: dev@castor.codehaus.org
Betreff: Re: AW: [castor-dev] [XML] Regression Issue with Transient
Fields


Eureka!

Found the difference between 0.9.6 and 0.9.7 in 
MappingLoader.createFieldHandler (these lines added in 0.9.7):

    //-- prevent introspection of transient fields
    if (fieldMap.getTransient()) {
       return new TransientFieldHandler();
    }

So by using the TransientFieldHandler, fieldType is null instead of 
being introspected.  So later, when the XMLMappingLoader queries the 
field type in order to check for a collection, field type is null, and 
CollectionHandlers.hasHandlers calls isArray on null, and NPE is thrown.

I'm not entirely sure the best solution to this problem, short of adding 
a lot of "&& !fieldDesc.isTransient()" to XMLMappingLoader.  Perhaps 
TransientFieldHandler can return Object instead of null for fieldType? 
Not sure of the ramifications of that to the rest of the system.

So now it's time for the professionals to wade in and share their 
thoughts on a solution :)

Thanks everyone,
Stephen


Werner Guttmann wrote:
> Thanks, Stephen, very much appreciated.
> 
> Werner
> 
> -----Ursprüngliche Nachricht-----
> Von: Stephen Bash [mailto:[EMAIL PROTECTED]
> Gesendet: Dienstag, 16. August 2005 15:05
> An: dev@castor.codehaus.org
> Betreff: Re: [castor-dev] [XML] Regression Issue with Transient Fields
> 
> 
> Werner-
> 
> I downloaded the latest CVS snapshot (behind firewall), and built the 
> jar using "build.bat jar".  I then replaced the Castor 0.9.7 release jar 
> in my classpath with the cvs jar and ran my test case.  The test case 
> produces an NPE at the same location.
> 
> I have some ideas of where the error might be coming from, but I need to 
> do some more digging first.  I'll let you know what I find.
> 
> Thanks,
> Stephen
> 
> 
> Werner Guttmann wrote:
> 
>>Stephen,
>>
>>I think you are right in that I have fixed a problem that does not seem to be 
>>related to your problem (however close or similar the underlying story is ... 
>>). Anyhow, any additional (regression) tester joining us would be welcome ... 
>>;-).
>>
>>Werner 
>>
>>-----Ursprüngliche Nachricht-----
>>Von: Stephen Bash [mailto:[EMAIL PROTECTED]
>>Gesendet: Dienstag, 16. August 2005 14:00
>>An: dev@castor.codehaus.org
>>Betreff: Re: AW: [castor-dev] [XML] Regression Issue with Transient
>>Fields
>>
>>
>>Werner-
>>
>>I'll see what I can do about fetching the CVS version and testing it 
>>out.  But seeing as the error occurs at the instantiation of the (XML) 
>>Unmarshaller rather than at loadMapping() your last comment may hit the 
>>nail on the head.
>>
>>Thanks,
>>Stephen
>>
>>
>>Werner Guttmann wrote:
>>
>>
>>>Stephen,
>>>
>>>afair, we haved fixed either exactly this issue or a similar in CVS already. 
>>>Could you try and report back to us whether this has been resolved ? 
>>>
>>>Werner
>>>
>>>PS It could be that this has been fixed at the <sql> level only, though ?  
>>>
>>>-----Ursprüngliche Nachricht-----
>>>Von: Stephen Bash [mailto:[EMAIL PROTECTED]
>>>Gesendet: Montag, 15. August 2005 18:01
>>>An: dev@castor.codehaus.org
>>>Betreff: [castor-dev] [XML] Regression Issue with Transient Fields
>>>
>>>
>>>Everyone-
>>>
>>>I know I'm a little slow finding to be finding what appears to be a 
>>>regression issue with 0.9.7 now, but I figure better late than never right?
>>>
>>>Last week I went back to a project I hadn't touched in a while, and the 
>>>mapping file (used for XML marshalling and unmarshalling) had a few 
>>>fields labeled as transient.  When I went to run the code, I received a 
>>>NPE when I attempted to create an Unmarshaller using new Unmarshaller( 
>>>mappingObj ) (see below for full trace).
>>>
>>>I finally traced it down to the fact that I had not specified types for 
>>>the transient fields in the mapping file:
>>>
>>>   <field name="names" transient="true" />
>>>
>>>versus:
>>>
>>>   <field name="names" transient="true" type="string"
>>>          collection="array" />
>>>
>>>I honestly prefer the former (from my perspective, Castor shouldn't 
>>>waste clock cycles -- or programmer keystrokes -- on a field it doesn't 
>>>care about), but if this behavior was changed for a reason, I'd be 
>>>interested to hear it. (BTW, the latter form is not backward compatible 
>>>with 0.9.6 either, so it seems to be an all or nothing game)
>>>
>>>I ran the same code with castor-0.9.7.jar and castor-0.9.6-xml.jar.  In 
>>>0.9.6 the code runs fine, in 0.9.7 I get the exception.  I'm running in 
>>>Eclipse 3.1 on JDK 1.4.2 on WinXP Pro.
>>>
>>>Thanks everyone, and I'm happy to hear any comments anyone has.
>>>
>>>Stephen
>>>
>>>The exception:
>>>
>>>java.lang.NullPointerException
>>>     at 
>>>org.exolab.castor.mapping.loader.CollectionHandlers.hasHandler(CollectionHandlers.java:128)
>>>     at 
>>>org.exolab.castor.xml.XMLMappingLoader.createFieldDesc(XMLMappingLoader.java:515)
>>>     at 
>>>org.exolab.castor.mapping.loader.MappingLoader.createFieldDescs(MappingLoader.java:639)
>>>     at 
>>>org.exolab.castor.mapping.loader.MappingLoader.createDescriptor(MappingLoader.java:462)
>>>     at 
>>>org.exolab.castor.xml.XMLMappingLoader.createDescriptor(XMLMappingLoader.java:227)
>>>     at 
>>>org.exolab.castor.mapping.loader.MappingLoader.loadMapping(MappingLoader.java:282)
>>>     at org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:292)
>>>     at org.exolab.castor.mapping.Mapping.getResolver(Mapping.java:247)
>>>     at org.exolab.castor.xml.Unmarshaller.setMapping(Unmarshaller.java:475)
>>>     at org.exolab.castor.xml.Unmarshaller.<init>(Unmarshaller.java:246)
>>>
>>>-------------------------------------------------
>>>If you wish to unsubscribe from this list, please 
>>>send an empty message to the following address:
>>>
>>>[EMAIL PROTECTED]
>>>-------------------------------------------------
>>>
>>>
>>>
>>>-------------------------------------------------
>>>If you wish to unsubscribe from this list, please 
>>>send an empty message to the following address:
>>>
>>>[EMAIL PROTECTED]
>>>-------------------------------------------------
>>>
>>>
>>
>>
>>-------------------------------------------------
>>If you wish to unsubscribe from this list, please 
>>send an empty message to the following address:
>>
>>[EMAIL PROTECTED]
>>-------------------------------------------------
>>
>>
>>
>>-------------------------------------------------
>>If you wish to unsubscribe from this list, please 
>>send an empty message to the following address:
>>
>>[EMAIL PROTECTED]
>>-------------------------------------------------
>>
>>
> 
> 
> -------------------------------------------------
> If you wish to unsubscribe from this list, please 
> send an empty message to the following address:
> 
> [EMAIL PROTECTED]
> -------------------------------------------------
> 
> 
> 
> -------------------------------------------------
> If you wish to unsubscribe from this list, please 
> send an empty message to the following address:
> 
> [EMAIL PROTECTED]
> -------------------------------------------------
> 
> 

-------------------------------------------------
If you wish to unsubscribe from this list, please 
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------



-------------------------------------------------
If you wish to unsubscribe from this list, please
send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to