From 882156c0fd3292b9ac7b8c0a154b2fc54b4e7704 Mon Sep 17 00:00:00 2001 From: Christian Wulf <chw@informatik.uni-kiel.de> Date: Thu, 11 Dec 2014 14:27:35 +0100 Subject: [PATCH] refactored Stage --- src/main/java/teetime/framework/Stage.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/teetime/framework/Stage.java b/src/main/java/teetime/framework/Stage.java index fd1d428f..988fb9e6 100644 --- a/src/main/java/teetime/framework/Stage.java +++ b/src/main/java/teetime/framework/Stage.java @@ -34,16 +34,16 @@ public abstract class Stage { // NOPMD (should not start with "Abstract" } private String createId() { - int instances = 0; String simpleName = this.getClass().getSimpleName(); - if (INSTANCES_COUNTER.containsKey(simpleName)) { - instances = INSTANCES_COUNTER.get(simpleName); + Integer numInstances = INSTANCES_COUNTER.get(simpleName); + if (null == numInstances) { + numInstances = 0; } - String id = simpleName + "-" + instances; - INSTANCES_COUNTER.put(simpleName, ++instances); - return id; + String newId = simpleName + "-" + numInstances; + INSTANCES_COUNTER.put(simpleName, ++numInstances); + return newId; } // public abstract Stage getParentStage(); -- GitLab