aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-testing-harness
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2015-01-06 23:18:38 +0100
committerSimon Brandhof <simon.brandhof@sonarsource.com>2015-01-06 23:18:38 +0100
commit983c550c085539c485e03119644984cb9fecc880 (patch)
tree52a0a6c0bbeb878d23eb0b443e36bf709b5c7131 /sonar-testing-harness
parent8ff5eaf75ab5d68aba4c7993d1aa2b2ba4c1f36c (diff)
downloadsonarqube-983c550c085539c485e03119644984cb9fecc880.tar.gz
sonarqube-983c550c085539c485e03119644984cb9fecc880.zip
Fix quality flaws
Diffstat (limited to 'sonar-testing-harness')
-rw-r--r--sonar-testing-harness/src/main/java/org/sonar/test/i18n/BundleSynchronizedMatcher.java12
1 files changed, 3 insertions, 9 deletions
diff --git a/sonar-testing-harness/src/main/java/org/sonar/test/i18n/BundleSynchronizedMatcher.java b/sonar-testing-harness/src/main/java/org/sonar/test/i18n/BundleSynchronizedMatcher.java
index fdb16924b63..00b333144ad 100644
--- a/sonar-testing-harness/src/main/java/org/sonar/test/i18n/BundleSynchronizedMatcher.java
+++ b/sonar-testing-harness/src/main/java/org/sonar/test/i18n/BundleSynchronizedMatcher.java
@@ -24,10 +24,8 @@ import org.apache.commons.io.IOUtils;
import org.hamcrest.BaseMatcher;
import org.hamcrest.Description;
-import java.io.BufferedWriter;
import java.io.File;
import java.io.FileOutputStream;
-import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStreamWriter;
@@ -76,7 +74,7 @@ public class BundleSynchronizedMatcher extends BaseMatcher<String> {
// And fail only if there are missing keys
return missingKeys.isEmpty();
} catch (IOException e) {
- fail("An error occured while reading the bundles: " + e.getMessage());
+ fail("An error occurred while reading the bundles: " + e.getMessage());
return false;
} finally {
IOUtils.closeQuietly(bundleInputStream);
@@ -123,19 +121,15 @@ public class BundleSynchronizedMatcher extends BaseMatcher<String> {
dumpFile.delete();
}
dumpFile.getParentFile().mkdirs();
- Writer writer = null;
- try {
- writer = new OutputStreamWriter(new FileOutputStream(dumpFile), Charsets.UTF_8);
+ try (Writer writer = new OutputStreamWriter(new FileOutputStream(dumpFile), Charsets.UTF_8)) {
writer.write(details);
} catch (IOException e) {
throw new IllegalStateException("Unable to write the report to 'target/l10n/" + bundleName + ".report.txt'", e);
- } finally {
- IOUtils.closeQuietly(writer);
}
}
protected static SortedMap<String, String> retrieveMissingTranslations(InputStream bundle, InputStream referenceBundle) throws IOException {
- SortedMap<String, String> missingKeys = new TreeMap();
+ SortedMap<String, String> missingKeys = new TreeMap<>();
Properties bundleProps = loadProperties(bundle);
Properties referenceProperties = loadProperties(referenceBundle);