eclipse-ee4j / jaxb-ri

Jaxb RI
https://eclipse-ee4j.github.io/jaxb-ri/
BSD 3-Clause "New" or "Revised" License
202 stars 110 forks source link

@XmlElement on hashmap-property prevents marshalling #755

Open Tomas-Kraus opened 14 years ago

Tomas-Kraus commented 14 years ago

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]

Tomas-Kraus commented 6 years ago
Tomas-Kraus commented 14 years ago

@glassfishrobot Commented Reported by mbz

Tomas-Kraus commented 13 years ago

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

Tomas-Kraus commented 14 years ago

@glassfishrobot Commented Was assigned to yaroska

Tomas-Kraus commented 7 years ago

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