castor

UnmarshallHandler fails to handle constructor arguments when "container=false"

Details

  • Type: Bug Bug
  • Status: Open Open
  • Priority: Major Major
  • Resolution: Unresolved
  • Affects Version/s: 1.0.5
  • Fix Version/s: None
  • Component/s: XML
  • Labels:
    None
  • Environment:
    Java JRE 1.5
  • Testcase included:
    yes
  • Number of attachments :
    1

Description

Unmarshalling a list of objects that have constructor arguments fails when "container=false" is set.

— EXCEPTION: —
org.xml.sax.SAXException: constructor arguments can only be used with an ExtendedFieldHandler.

— CLASSES: —
public class Path {
private final String name;
public Path(final String name) { super(); this.name = name; }
public final String getName() { return name; }
}
public class Area {
private final String name;
private List pathList;
public Area(final String name) { this.name = name; }
public final String getName() { return name; } }
public final List getPathList() { return pathList; }
public final void setPathList(final List list) { this.pathList = list; }
}

— MAPPING: —
<mapping>
<class name="xml.problem.Path" verify-constructable="false">
<field name="name" set-method="%1" get-method="getName" type="string">
<bind-xml node="attribute" />
</field>
</class>
<class name="xml.problem.Area" verify-constructable="false">
<field name="name" set-method="%1" get-method="getName" type="string">
<bind-xml node="attribute"/>
</field>
<field name="pathList"
type="xml.problem.Path"
collection="arraylist"
container="false">
<bind-xml name="path-list" node="element" />
</field>
</class>
</mapping>

— XML: —
<area name="Hamburg">
<path-list>
<path name="/eng/hamburg"/>
<path name="/deu/hamburg"/>
</path-list>
</area>

Activity

There are no comments yet on this issue.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated: