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]
-------------------------------------------------