Author: tchemit Date: 2009-01-16 18:52:46 +0000 (Fri, 16 Jan 2009) New Revision: 1309 Modified: topia/trunk/topia-persistence/src/main/java/org/codelutin/topia/persistence/flatfile/TopiaDAOFlatFile.java Log: fix a NPE of TopiaDAOFlatFile when do a putAll on a map with some null values on entries. (some map implementation does not like it, neither the Map contract) Modified: topia/trunk/topia-persistence/src/main/java/org/codelutin/topia/persistence/flatfile/TopiaDAOFlatFile.java =================================================================== --- topia/trunk/topia-persistence/src/main/java/org/codelutin/topia/persistence/flatfile/TopiaDAOFlatFile.java 2009-01-16 18:51:00 UTC (rev 1308) +++ topia/trunk/topia-persistence/src/main/java/org/codelutin/topia/persistence/flatfile/TopiaDAOFlatFile.java 2009-01-16 18:52:46 UTC (rev 1309) @@ -50,6 +50,7 @@ import java.util.List; import java.util.Map; import java.util.Properties; +import java.util.Map.Entry; import org.apache.commons.beanutils.BeanUtils; import org.apache.commons.beanutils.PropertyUtils; @@ -308,8 +309,14 @@ } } - - prop.putAll(propMap); + for (Entry<String, String> entry : propMap.entrySet()) { + String value = entry.getValue(); + if (value !=null) { + prop.put(entry.getKey(), value); + } + } + // if some entries has a null values, there is a NullPointerException + //prop.putAll(propMap); FileOutputStream out = new FileOutputStream(f); prop.store(out, "flatfile topia persistence entity"); out.close();