From 6079ef842ee0ac3d9f86f2dad3784dc9cb92ac5e Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Mon, 21 Oct 2013 15:23:54 +0200 Subject: Fix some quality flaws --- .../java/org/sonar/api/utils/internal/DefaultTempFolder.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'sonar-plugin-api') diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/internal/DefaultTempFolder.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/internal/DefaultTempFolder.java index 80665d76374..8fc9dd52f7b 100644 --- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/internal/DefaultTempFolder.java +++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/internal/DefaultTempFolder.java @@ -27,6 +27,7 @@ import javax.annotation.Nullable; import java.io.File; import java.io.IOException; +import java.text.MessageFormat; public class DefaultTempFolder implements TempFolder { @@ -56,9 +57,8 @@ public class DefaultTempFolder implements TempFolder { return tempDir; } } - throw new IllegalStateException("Failed to create directory within " - + TEMP_DIR_ATTEMPTS + " attempts (tried " - + baseName + "0 to " + baseName + (TEMP_DIR_ATTEMPTS - 1) + ')'); + throw new IllegalStateException(MessageFormat.format("Failed to create directory within {0} attempts (tried {1} to {2})", TEMP_DIR_ATTEMPTS, baseName + 0, baseName + + (TEMP_DIR_ATTEMPTS - 1))); } @Override @@ -98,9 +98,8 @@ public class DefaultTempFolder implements TempFolder { } catch (IOException e) { throw new IllegalStateException("Failed to create temp file", e); } - throw new IllegalStateException("Failed to create temp file within " - + TEMP_DIR_ATTEMPTS + " attempts (tried " - + baseName + "0" + suffix + " to " + baseName + (TEMP_DIR_ATTEMPTS - 1) + suffix + ")"); + throw new IllegalStateException(MessageFormat.format("Failed to create temp file within {0} attempts (tried {1} to {2})", TEMP_DIR_ATTEMPTS, baseName + 0 + suffix, baseName + + (TEMP_DIR_ATTEMPTS - 1) + suffix)); } public void clean() { -- cgit v1.2.3