]> source.dussan.org Git - sonarqube.git/commitdiff
Fix some quality flaws
authorJulien HENRY <julien.henry@sonarsource.com>
Mon, 21 Oct 2013 13:23:54 +0000 (15:23 +0200)
committerJulien HENRY <julien.henry@sonarsource.com>
Mon, 21 Oct 2013 13:23:54 +0000 (15:23 +0200)
sonar-plugin-api/src/main/java/org/sonar/api/utils/internal/DefaultTempFolder.java

index 80665d7637492b71e105be70dffa073b510a8dc1..8fc9dd52f7b1edd9084cbe86fefc7759bec6d028 100644 (file)
@@ -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() {