freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [1/2] incubator-freemarker git commit: More Null-safe Configurable.clone()
Date Tue, 07 Jun 2016 22:57:12 GMT
Repository: incubator-freemarker
Updated Branches:
  refs/heads/2.3-gae 346797e45 -> 2b5648804


More Null-safe Configurable.clone()


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/964757b0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/964757b0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/964757b0

Branch: refs/heads/2.3-gae
Commit: 964757b0669692ebf9031961406341a7b8bca20b
Parents: 346797e
Author: ddekany <ddekany@apache.org>
Authored: Wed Jun 8 00:37:53 2016 +0200
Committer: ddekany <ddekany@apache.org>
Committed: Wed Jun 8 00:37:53 2016 +0200

----------------------------------------------------------------------
 src/main/java/freemarker/core/Configurable.java | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/964757b0/src/main/java/freemarker/core/Configurable.java
----------------------------------------------------------------------
diff --git a/src/main/java/freemarker/core/Configurable.java b/src/main/java/freemarker/core/Configurable.java
index 40e873e..18e6fcd 100644
--- a/src/main/java/freemarker/core/Configurable.java
+++ b/src/main/java/freemarker/core/Configurable.java
@@ -444,8 +444,12 @@ public class Configurable {
     @Override
     protected Object clone() throws CloneNotSupportedException {
         Configurable copy = (Configurable) super.clone();
-        copy.properties = new Properties(properties);
-        copy.customAttributes = (HashMap) customAttributes.clone();
+        if (properties != null) {
+            copy.properties = new Properties(properties);
+        }
+        if (customAttributes != null) {
+            copy.customAttributes = (HashMap) customAttributes.clone();
+        }
         if (autoImports != null) {
             copy.autoImports = (LinkedHashMap<String, String>) autoImports.clone();
         }


Mime
View raw message