Repository: commons-lang Updated Branches: refs/heads/master a945ecbbd -> 8c5335e6c
[LANG-1144] Multiple calls of org.apache.commons.lang3.concurrent.LazyInitializer.initialize() are possible. Project: http://git-wip-us.apache.org/repos/asf/commons-lang/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-lang/commit/e4c72a55 Tree: http://git-wip-us.apache.org/repos/asf/commons-lang/tree/e4c72a55 Diff: http://git-wip-us.apache.org/repos/asf/commons-lang/diff/e4c72a55 Branch: refs/heads/master Commit: e4c72a5522aabfa6a660088aa9262d849756e464 Parents: 65ed41f Author: Gary Gregory <ggreg...@apache.org> Authored: Sun Oct 23 10:33:29 2016 -0700 Committer: Gary Gregory <ggreg...@apache.org> Committed: Sun Oct 23 10:33:29 2016 -0700 ---------------------------------------------------------------------- src/changes/changes.xml | 3 ++- .../apache/commons/lang3/concurrent/LazyInitializer.java | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-lang/blob/e4c72a55/src/changes/changes.xml ---------------------------------------------------------------------- diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 196af87..64fc5cf 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -45,7 +45,8 @@ The <action> type attribute can be add,update,fix,remove. </properties> <body> - <release version="3.6" date="tba" description="tba"> + <release version="3.6" date="2016-MM-DD" description="TBD"> + <action issue="LANG-1144" type="fix" dev="ggregory" due-to="Waldemar Maier, Gary Gregory">Multiple calls of org.apache.commons.lang3.concurrent.LazyInitializer.initialize() are possible.</action> <action issue="LANG-1276" type="fix" dev="pschumacher" due-to="Andy Klimczak">StrBuilder#replaceAll ArrayIndexOutOfBoundsException</action> <action issue="LANG-1278" type="fix" dev="pschumacher" due-to="Duke Yin">BooleanUtils javadoc issues</action> <action issue="LANG-1277" type="update" dev="pschumacher" due-to="yufcuy">StringUtils#getLevenshteinDistance reduce memory consumption</action> http://git-wip-us.apache.org/repos/asf/commons-lang/blob/e4c72a55/src/main/java/org/apache/commons/lang3/concurrent/LazyInitializer.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/lang3/concurrent/LazyInitializer.java b/src/main/java/org/apache/commons/lang3/concurrent/LazyInitializer.java index be5482a..a0f903c 100644 --- a/src/main/java/org/apache/commons/lang3/concurrent/LazyInitializer.java +++ b/src/main/java/org/apache/commons/lang3/concurrent/LazyInitializer.java @@ -79,7 +79,10 @@ package org.apache.commons.lang3.concurrent; */ public abstract class LazyInitializer<T> implements ConcurrentInitializer<T> { /** Stores the managed object. */ - private volatile T object; + + private static final Object NoInit = new Object(); + + private volatile T object = (T) NoInit; /** * Returns the object wrapped by this instance. On first access the object @@ -95,10 +98,10 @@ public abstract class LazyInitializer<T> implements ConcurrentInitializer<T> { // volatile field T result = object; - if (result == null) { + if (result == NoInit) { synchronized (this) { result = object; - if (result == null) { + if (result == NoInit) { object = result = initialize(); } }