diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java b/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java index 51be1b2e1..bae3b3ca2 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/junit/AggregateTransformer.java @@ -115,7 +115,7 @@ public class AggregateTransformer { /** * Used to ensure the uniqueness of a property */ - private static int counter = 0; + private volatile static int counter = 0; /** the format to use for the report. Must be FRAMES or NOFRAMES */ protected String format = FRAMES; @@ -260,7 +260,7 @@ public class AggregateTransformer { xsltTask.setIn(((XMLResultAggregator) task).getDestinationFile()); File outputFile = null; if (format.equals(FRAMES)) { - String tempFileProperty = getClass().getName() + String.valueOf(counter++); + String tempFileProperty = getClass().getName() + String.valueOf(counter++); //NOSONAR File tmp = FILE_UTILS.resolveFile(project.getBaseDir(), project .getProperty("java.io.tmpdir")); tempFileTask.setDestDir(tmp); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java index 146e0ffd0..9d995bce6 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/splash/SplashTask.java @@ -53,6 +53,7 @@ public class SplashTask extends Task { private String progressRegExp = null; private String displayText = null; + // class instance so we'll never show two splash screens at the same time private static SplashScreen splash = null; /** @@ -163,7 +164,7 @@ public class SplashTask extends Task { splash.setVisible(false); getProject().removeBuildListener(splash); splash.dispose(); - splash = null; + splash = null; //NOSONAR } log("Creating new SplashScreen", Project.MSG_VERBOSE); @@ -248,7 +249,7 @@ public class SplashTask extends Task { try { ImageIcon img = new ImageIcon(bout.toByteArray()); - splash = new SplashScreen(img, progressRegExp, displayText); + splash = new SplashScreen(img, progressRegExp, displayText); //NOSONAR success = true; } catch (Throwable e) { logHeadless(e); @@ -268,7 +269,7 @@ public class SplashTask extends Task { } } else { try { - splash = new SplashScreen("Image Unavailable.", progressRegExp, + splash = new SplashScreen("Image Unavailable.", progressRegExp, //NOSONAR displayText); success = true; } catch (Throwable e) {