Skip to content
This repository has been archived by the owner on Feb 5, 2019. It is now read-only.

@XmlElement on hashmap-property prevents marshalling #755

Open
glassfishrobot opened this issue May 5, 2010 · 4 comments
Open

@XmlElement on hashmap-property prevents marshalling #755

glassfishrobot opened this issue May 5, 2010 · 4 comments

Comments

@glassfishrobot
Copy link
Contributor

The following code snippet fails to marshal as expected. If @xmlelement is
removed anything works like a charm.

class Order {
private HashMap<Integer, Integer> oi;

public Order() {}
public Order(HashMap<Integer, Integer> oi)

{ this.oi = oi;}

@xmlelement
public void setOi(HashMap<Integer, Integer> oi)

{ this.oi = oi; }

public HashMap<Integer, Integer> getOi()

{ return this.oi; }

public static void main(String[] args)

{ JAXBContext context = JAXBContext.newInstance(Order.class); Marshaller marshaller = context.createMarshaller(); HashMap<Integer, Integer> oi = new HashMap<Integer, Integer>(); oi.put(1,1); oi.put(2,2); Order order = new Order(oi); marshaller.marshal(order, new PrintWriter(System.out)); }

}

Environment

Operating System: All
Platform: All

Affected Versions

[2.2]

@glassfishrobot
Copy link
Contributor Author

Reported by mbz

@glassfishrobot
Copy link
Contributor Author

Was assigned to yaroska

@glassfishrobot
Copy link
Contributor Author

pkotlov said:
Same here. Since i normally use @xmlelement(name="x-y") it really breaks my schema.

@glassfishrobot
Copy link
Contributor Author

This issue was imported from java.net JIRA JAXB-755

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant