merge with master
[nikiroo-utils.git] / library / Template.java
index 3536d5f12efccf7da066ce4b1d140553c633e631..a116ef67f23f3ae237f72d5fffed58bf7a9f31d5 100644 (file)
@@ -64,22 +64,27 @@ public class Template {
 
                        i++;
                }
-               
+
                InputStream in = IOUtils.openResource(location, name);
                return new ReplaceInputStream(in, from, to);
        }
 
        public synchronized Template set(String key, String value) {
-               values.put(key, value);
+               values.put(key, value == null ? "" : value);
                valuesTemplate.remove(key);
                valuesTemplateList.remove(key);
                return this;
        }
 
        public synchronized Template set(String key, Template value) {
+               if (value == null) {
+                       return set(key, "");
+               }
+
                values.remove(key);
                valuesTemplate.put(key, value);
                valuesTemplateList.remove(key);
+
                return this;
        }