mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-18 03:01:05 +01:00
fix bug in property xml serialization
This commit is contained in:
@@ -39,7 +39,6 @@ import sonia.scm.util.Util;
|
|||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -50,7 +49,7 @@ import javax.xml.bind.annotation.adapters.XmlAdapter;
|
|||||||
* @author Sebastian Sdorra
|
* @author Sebastian Sdorra
|
||||||
*/
|
*/
|
||||||
public class XmlMapStringAdapter
|
public class XmlMapStringAdapter
|
||||||
extends XmlAdapter<ArrayList<XmlMapStringElement>, Map<String, String>>
|
extends XmlAdapter<XmlMapStringElement[], Map<String, String>>
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -64,21 +63,27 @@ public class XmlMapStringAdapter
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ArrayList<XmlMapStringElement> marshal(Map<String, String> map)
|
public XmlMapStringElement[] marshal(Map<String, String> map) throws Exception
|
||||||
throws Exception
|
|
||||||
{
|
{
|
||||||
ArrayList<XmlMapStringElement> elements =
|
XmlMapStringElement[] elements = null;
|
||||||
new ArrayList<XmlMapStringElement>();
|
|
||||||
|
|
||||||
if (Util.isNotEmpty(map))
|
if (Util.isNotEmpty(map))
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
int s = map.size();
|
||||||
|
|
||||||
|
elements = new XmlMapStringElement[s];
|
||||||
|
|
||||||
for (Map.Entry<String, String> e : map.entrySet())
|
for (Map.Entry<String, String> e : map.entrySet())
|
||||||
{
|
{
|
||||||
elements.add(new XmlMapStringElement(e.getKey(), e.getValue()));
|
elements[i] = new XmlMapStringElement(e.getKey(), e.getValue());
|
||||||
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
elements = new XmlMapStringElement[0];
|
||||||
|
}
|
||||||
|
|
||||||
return elements;
|
return elements;
|
||||||
}
|
}
|
||||||
@@ -94,7 +99,7 @@ public class XmlMapStringAdapter
|
|||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<String, String> unmarshal(ArrayList<XmlMapStringElement> elements)
|
public Map<String, String> unmarshal(XmlMapStringElement[] elements)
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
Map<String, String> map = new HashMap<String, String>();
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
|
|||||||
Reference in New Issue
Block a user