Issue Details (XML | Word | Printable)

Key: XSTR-418
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Joerg Schaible
Reporter: Matt Kinman
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
XStream

Attribute alias of super class ignored during unmarshal.

Created: 31/Jul/07 04:28 PM   Updated: 25/Feb/08 05:01 PM   Resolved: 23/Nov/07 04:27 PM
Component/s: Annotations
Affects Version/s: 1.2.2
Fix Version/s: 1.3

File Attachments: 1. Zip Archive test.zip (1 kB)

Issue Links:
Duplicate
 
Related
 

JDK version and platform: 1.6.0_02 for Windows


 Description  « Hide

The @XStreamAlias annotation is ignored during unmarshalling for @XStreamAsAttribute annotated fields of a base class. A quick example of the failure:

public abstract class BaseClass {

@XStreamAlias("guid")
@XStreamAsAttribute
private Integer id;

public Integer getId() { return id; }

public void setId(Integer id) { this.id = id; }
}

@XStreamAlias("foo")
public class Foo extends BaseClass {

@XStreamAlias("fooname")
@XStreamAsAttribute
private String name;

public Foo() { super(); }

public String getName() { return name; }

public void setName(String name) { this.name = name; }
}

Marshalling a Foo object to xml produces the correct content:

<foo fooname="Name" guid="99"/>

Unmarshalling this exact output, however, produces a Foo object that has only the Name set correctly, not the id (aliased as guid in the super class). Id is left null.

I've attached an example Test program which demonstrates the break. Normal non-attribute fields' aliases are honored correctly from super classes, however.



Sort Order: Ascending order - Click to sort in descending order
Joerg Schaible added a comment - 23/Nov/07 04:27 PM

Solved in the head revision. You may give it a try.


Joerg Schaible added a comment - 25/Feb/08 05:01 PM

Closing issues before next release.