castor

ClassCastException when marshalling Iterator

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.1.2.1
  • Fix Version/s: 1.2
  • Component/s: XML
  • Labels:
    None
  • Environment:
    Windows
  • Testcase included:
    yes
  • Number of attachments :
    3

Description

When trying to marshall a class which has a method that returns an Iterator a ClassCastException is thrown.

java.lang.ClassCastException: java.util.AbstractList$Itr
at org.exolab.castor.mapping.loader.J2CollectionHandlers$6.elements(J2CollectionHandlers.java:276)
at org.exolab.castor.mapping.loader.FieldHandlerImpl.getValue(FieldHandlerImpl.java:444)
at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:1740)
at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:836)
at test.castor.IteratorMarshallTest.testMarshallIterator(IteratorMarshallTest.java:28)

This is because an Iterator is being cast to an Enumeration at line 276 in org.exolab.castor.mapping.loader.J2CollectionHandlers.

[Our project used Castor 0.9.9. We moved to Castor 1.1.2.1 recently and started seeing this problem]

  1. DomainClass.java
    22/Jan/08 5:11 PM
    0.3 kB
    Abhinav Sopory
  2. IteratorMarshallTest.java
    22/Jan/08 5:11 PM
    1 kB
    Abhinav Sopory
  3. patch.c2270.20080123.txt
    23/Jan/08 3:27 AM
    4 kB
    Werner Guttmann

Activity

Hide
Werner Guttmann added a comment -

Final patch for review.

Show
Werner Guttmann added a comment - Final patch for review.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved:

Time Tracking

Estimated:
45m
Original Estimate - 45 minutes
Remaining:
10m
Time Spent - 35 minutes Remaining Estimate - 10 minutes
Logged:
35m
Time Spent - 35 minutes Remaining Estimate - 10 minutes