aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakozak2011-11-21 08:18:50 (EST)
committerWinston Prakash2011-12-01 20:46:51 (EST)
commit0efa84441abdcdbda74b3675ff0e6ae72ffa394b (patch)
tree6516e3fd07fdb1e499667fb75922f3957eb6429f
parentec490b610887821f18708e1e70b73a53ea2624f4 (diff)
downloadorg.eclipse.hudson.core-0efa84441abdcdbda74b3675ff0e6ae72ffa394b.zip
org.eclipse.hudson.core-0efa84441abdcdbda74b3675ff0e6ae72ffa394b.tar.gz
org.eclipse.hudson.core-0efa84441abdcdbda74b3675ff0e6ae72ffa394b.tar.bz2
Initialize allowSave variable in onLoad action
Signed-off-by: Winston Prakash <winston.prakash@gmail.com>
-rw-r--r--hudson-core/src/main/java/hudson/model/Job.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/hudson-core/src/main/java/hudson/model/Job.java b/hudson-core/src/main/java/hudson/model/Job.java
index 61512f6..76d982b 100644
--- a/hudson-core/src/main/java/hudson/model/Job.java
+++ b/hudson-core/src/main/java/hudson/model/Job.java
@@ -154,7 +154,7 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
*/
private transient JobT template;
- protected final transient ThreadLocal<Boolean> allowSave = new ThreadLocal<Boolean>() {
+ protected transient volatile ThreadLocal<Boolean> allowSave = new ThreadLocal<Boolean>() {
@Override
protected Boolean initialValue() {
return true;
@@ -179,7 +179,14 @@ public abstract class Job<JobT extends Job<JobT, RunT>, RunT extends Run<JobT, R
throws IOException {
super.onLoad(parent, name);
template = (JobT) Functions.getItemByName(Hudson.getInstance().getAllItems(this.getClass()), templateName);
-
+ if (null == allowSave) {// Initialize property if null.
+ allowSave = new ThreadLocal<Boolean>() {
+ @Override
+ protected Boolean initialValue() {
+ return true;
+ }
+ };
+ }
TextFile f = getNextBuildNumberFile();
if (f.exists()) {
// starting 1.28, we store nextBuildNumber in a separate file.