You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@freemarker.apache.org by dd...@apache.org on 2016/06/12 16:54:12 UTC
[31/50] incubator-freemarker git commit: More Null-safe
Configurable.clone()
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
Commit: 964757b0669692ebf9031961406341a7b8bca20b
Parents: 346797e
Author: ddekany <dd...@apache.org>
Authored: Wed Jun 8 00:37:53 2016 +0200
Committer: ddekany <dd...@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();
}