diff --git a/scm-core/src/main/java/sonia/scm/xml/XmlMapStringAdapter.java b/scm-core/src/main/java/sonia/scm/xml/XmlMapStringAdapter.java index e8a4f32906..565b0f5f40 100644 --- a/scm-core/src/main/java/sonia/scm/xml/XmlMapStringAdapter.java +++ b/scm-core/src/main/java/sonia/scm/xml/XmlMapStringAdapter.java @@ -36,9 +36,7 @@ package sonia.scm.xml; //~--- JDK imports ------------------------------------------------------------ import java.util.HashMap; -import java.util.HashSet; import java.util.Map; -import java.util.Set; import javax.xml.bind.annotation.adapters.XmlAdapter; @@ -47,7 +45,7 @@ import javax.xml.bind.annotation.adapters.XmlAdapter; * @author Sebastian Sdorra */ public class XmlMapStringAdapter - extends XmlAdapter, Map> + extends XmlAdapter> { /** @@ -61,36 +59,36 @@ public class XmlMapStringAdapter * @throws Exception */ @Override - public Set marshal(Map map) - throws Exception + public XmlMapStringElement[] marshal(Map map) throws Exception { - Set set = new HashSet(); + XmlMapStringElement[] elements = new XmlMapStringElement[map.size()]; + int i = 0; for (Map.Entry e : map.entrySet()) { - set.add(new XmlMapStringElement(e.getKey(), e.getValue())); + elements[i++] = new XmlMapStringElement(e.getKey(), e.getValue()); } - return set; + return elements; } /** * Method description * * - * @param set + * @param elements * * @return * * @throws Exception */ @Override - public Map unmarshal(Set set) + public Map unmarshal(XmlMapStringElement[] elements) throws Exception { Map map = new HashMap(); - for (XmlMapStringElement e : set) + for (XmlMapStringElement e : elements) { map.put(e.getKey(), e.getValue()); }