[SOLR-3396] - avoid NPEs on appendMap method

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1329640 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Tommaso Teofili 2012-04-24 11:18:59 +00:00
parent b91898b5df
commit b3241a23b3
1 changed files with 8 additions and 10 deletions

View File

@ -23,13 +23,7 @@ import java.io.Writer;
import java.net.URLEncoder;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
import java.util.TimeZone;
import java.util.*;
import java.util.Map.Entry;
import java.nio.ByteBuffer;
@ -231,9 +225,13 @@ public class ClientUtils
}
public static void appendMap(String collection, Map<String,Slice> map1, Map<String,Slice> map2) {
Set<Entry<String,Slice>> entrySet = map2.entrySet();
for (Entry<String,Slice> entry : entrySet) {
map1.put(collection + "_" + entry.getKey(), entry.getValue());
if (map1==null)
map1 = new HashMap<String,Slice>();
if (map2!=null) {
Set<Entry<String,Slice>> entrySet = map2.entrySet();
for (Entry<String,Slice> entry : entrySet) {
map1.put(collection + "_" + entry.getKey(), entry.getValue());
}
}
}
}