Skip to content

Commit

Permalink
Replacing commons deprecated MultiHashMap with MultiValueHashMap
Browse files Browse the repository at this point in the history
  • Loading branch information
aaime committed Jun 1, 2019
1 parent 45a45f3 commit 662dde3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
import java.util.logging.Logger; import java.util.logging.Logger;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.apache.commons.collections.MultiHashMap; import org.apache.commons.collections.map.MultiValueMap;
import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.mapped.MappedXMLStreamWriter; import org.codehaus.jettison.mapped.MappedXMLStreamWriter;
import org.codehaus.jettison.util.FastStack; import org.codehaus.jettison.util.FastStack;
Expand Down Expand Up @@ -390,7 +390,7 @@ protected void init(XStream xs) {
xs.omitField(impl(DefaultCatalogFacade.class), "layerGroups"); xs.omitField(impl(DefaultCatalogFacade.class), "layerGroups");


xs.registerLocalConverter( xs.registerLocalConverter(
DefaultCatalogFacade.class, "stores", new StoreMultiHashMapConverter()); DefaultCatalogFacade.class, "stores", new StoreMultiValueMapConverter());
xs.registerLocalConverter( xs.registerLocalConverter(
DefaultCatalogFacade.class, "namespaces", new SpaceMapConverter("namespace")); DefaultCatalogFacade.class, "namespaces", new SpaceMapConverter("namespace"));
xs.registerLocalConverter( xs.registerLocalConverter(
Expand Down Expand Up @@ -1828,14 +1828,14 @@ public Object doUnmarshal(
} }


/** Converter for multi hash maps containing coverage stores and data stores. */ /** Converter for multi hash maps containing coverage stores and data stores. */
static class StoreMultiHashMapConverter implements Converter { static class StoreMultiValueMapConverter implements Converter {
public boolean canConvert(Class type) { public boolean canConvert(Class type) {
return MultiHashMap.class.equals(type); return MultiValueMap.class.equals(type);
} }


public void marshal( public void marshal(
Object source, HierarchicalStreamWriter writer, MarshallingContext context) { Object source, HierarchicalStreamWriter writer, MarshallingContext context) {
MultiHashMap map = (MultiHashMap) source; MultiValueMap map = (MultiValueMap) source;
for (Object v : map.values()) { for (Object v : map.values()) {
if (v instanceof DataStoreInfo) { if (v instanceof DataStoreInfo) {
writer.startNode("dataStore"); writer.startNode("dataStore");
Expand All @@ -1851,7 +1851,7 @@ public void marshal(
} }


public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) { public Object unmarshal(HierarchicalStreamReader reader, UnmarshallingContext context) {
MultiHashMap map = new MultiHashMap(); MultiValueMap map = new MultiValueMap();


while (reader.hasMoreChildren()) { while (reader.hasMoreChildren()) {
reader.moveDown(); reader.moveDown();
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.commons.collections.MultiHashMap; import org.apache.commons.collections.map.MultiValueMap;
import org.geoserver.catalog.Catalog; import org.geoserver.catalog.Catalog;
import org.geoserver.catalog.FeatureTypeInfo; import org.geoserver.catalog.FeatureTypeInfo;
import org.geoserver.catalog.NamespaceInfo; import org.geoserver.catalog.NamespaceInfo;
Expand Down Expand Up @@ -65,7 +65,7 @@ protected void write(
List featureCollections = results.getFeature(); List featureCollections = results.getFeature();


// round up the info objects for each feature collection // round up the info objects for each feature collection
MultiHashMap ns2metas = new MultiHashMap(); MultiValueMap ns2metas = new MultiValueMap();


for (Iterator fc = featureCollections.iterator(); fc.hasNext(); ) { for (Iterator fc = featureCollections.iterator(); fc.hasNext(); ) {
SimpleFeatureCollection features = (SimpleFeatureCollection) fc.next(); SimpleFeatureCollection features = (SimpleFeatureCollection) fc.next();
Expand Down

0 comments on commit 662dde3

Please sign in to comment.