diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-01-06 10:52:46 +0100 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2016-01-06 10:52:57 +0100 |
commit | 0fddc5fa4ea33882b60e072eee51f0e1ea585b4c (patch) | |
tree | ca06a067fbf862e691f47b0d342004f9dd97adea /sonar-batch | |
parent | a729de69050ef86f5da1a1c3b54b4c7d4d318893 (diff) | |
download | sonarqube-0fddc5fa4ea33882b60e072eee51f0e1ea585b4c.tar.gz sonarqube-0fddc5fa4ea33882b60e072eee51f0e1ea585b4c.zip |
Fix quality flaws5.4-M3
Diffstat (limited to 'sonar-batch')
8 files changed, 12 insertions, 12 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/report/AnalysisContextReportPublisher.java b/sonar-batch/src/main/java/org/sonar/batch/report/AnalysisContextReportPublisher.java index eb7f05b3b06..9f5f77e6fa8 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/report/AnalysisContextReportPublisher.java +++ b/sonar-batch/src/main/java/org/sonar/batch/report/AnalysisContextReportPublisher.java @@ -85,7 +85,7 @@ public class AnalysisContextReportPublisher { private void writeSystemProps(BufferedWriter fileWriter) throws IOException { fileWriter.write("System properties:\n"); Properties sysProps = system.properties(); - for (String prop : new TreeSet<String>(sysProps.stringPropertyNames())) { + for (String prop : new TreeSet<>(sysProps.stringPropertyNames())) { if (prop.startsWith(SONAR_PROP_PREFIX)) { continue; } @@ -96,7 +96,7 @@ public class AnalysisContextReportPublisher { private void writeEnvVariables(BufferedWriter fileWriter) throws IOException { fileWriter.append("Environment variables:\n"); Map<String, String> envVariables = system.envVariables(); - for (String env : new TreeSet<String>(envVariables.keySet())) { + for (String env : new TreeSet<>(envVariables.keySet())) { fileWriter.append(String.format(" - %s=%s", env, envVariables.get(env))).append('\n'); } } @@ -109,7 +109,7 @@ public class AnalysisContextReportPublisher { try (BufferedWriter fileWriter = Files.newBufferedWriter(analysisLog.toPath(), StandardCharsets.UTF_8, StandardOpenOption.WRITE, StandardOpenOption.APPEND)) { fileWriter.append(String.format("Settings for module: %s", moduleDefinition.getKey())).append('\n'); Map<String, String> moduleSettings = settings.getProperties(); - for (String prop : new TreeSet<String>(moduleSettings.keySet())) { + for (String prop : new TreeSet<>(moduleSettings.keySet())) { if (isSystemProp(prop) || isEnvVariable(prop) || !isSqProp(prop)) { continue; } diff --git a/sonar-batch/src/test/java/org/sonar/batch/cache/GlobalPersistentCacheProviderTest.java b/sonar-batch/src/test/java/org/sonar/batch/cache/GlobalPersistentCacheProviderTest.java index 829be758632..64d58899e8d 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/cache/GlobalPersistentCacheProviderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/cache/GlobalPersistentCacheProviderTest.java @@ -42,7 +42,7 @@ public class GlobalPersistentCacheProviderTest { @Before public void setUp() { - HashMap<String, String> map = new HashMap<String, String>(); + HashMap<String, String> map = new HashMap<>(); map.put("sonar.userHome", temp.getRoot().getAbsolutePath()); globalProperties = new GlobalProperties(map); provider = new GlobalPersistentCacheProvider(); diff --git a/sonar-batch/src/test/java/org/sonar/batch/repository/DefaultProjectRepositoriesLoaderTest.java b/sonar-batch/src/test/java/org/sonar/batch/repository/DefaultProjectRepositoriesLoaderTest.java index a577ca5113f..958ad48f4a7 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/repository/DefaultProjectRepositoriesLoaderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/repository/DefaultProjectRepositoriesLoaderTest.java @@ -126,7 +126,7 @@ public class DefaultProjectRepositoriesLoaderTest { @Test public void readRealResponse() throws IOException { InputStream is = getTestResource("project.protobuf"); - when(wsLoader.loadStream(anyString())).thenReturn(new WSLoaderResult<InputStream>(is, true)); + when(wsLoader.loadStream(anyString())).thenReturn(new WSLoaderResult<>(is, true)); ProjectRepositories proj = loader.load("org.sonarsource.github:sonar-github-plugin", true, null); FileData fd = proj.fileData("org.sonarsource.github:sonar-github-plugin", diff --git a/sonar-batch/src/test/java/org/sonar/batch/repository/DefaultQualityProfileLoaderTest.java b/sonar-batch/src/test/java/org/sonar/batch/repository/DefaultQualityProfileLoaderTest.java index 0d6179efa3e..cdce8a352e0 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/repository/DefaultQualityProfileLoaderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/repository/DefaultQualityProfileLoaderTest.java @@ -76,7 +76,7 @@ public class DefaultQualityProfileLoaderTest { @Test public void testNoProfile() throws IOException { InputStream is = createEncodedQP(); - when(ws.loadStream(anyString())).thenReturn(new WSLoaderResult<InputStream>(is, false)); + when(ws.loadStream(anyString())).thenReturn(new WSLoaderResult<>(is, false)); exception.expect(MessageException.class); exception.expectMessage("No quality profiles"); @@ -88,7 +88,7 @@ public class DefaultQualityProfileLoaderTest { @Test public void use_real_response() throws IOException { InputStream is = getTestResource("quality_profile_search_default"); - when(ws.loadStream(anyString())).thenReturn(new WSLoaderResult<InputStream>(is, false)); + when(ws.loadStream(anyString())).thenReturn(new WSLoaderResult<>(is, false)); List<QualityProfile> loaded = qpLoader.loadDefault(null, null); verify(ws).loadStream("/api/qualityprofiles/search.protobuf?defaults=true"); diff --git a/sonar-batch/src/test/java/org/sonar/batch/repository/DefaultServerIssuesLoaderTest.java b/sonar-batch/src/test/java/org/sonar/batch/repository/DefaultServerIssuesLoaderTest.java index 28efed6c877..0f9c435d22b 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/repository/DefaultServerIssuesLoaderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/repository/DefaultServerIssuesLoaderTest.java @@ -77,7 +77,7 @@ public class DefaultServerIssuesLoaderTest { public void testError() throws IOException { InputStream is = mock(InputStream.class); when(is.read()).thenThrow(IOException.class); - when(wsLoader.loadStream("/batch/issues.protobuf?key=foo")).thenReturn(new WSLoaderResult<InputStream>(is, true)); + when(wsLoader.loadStream("/batch/issues.protobuf?key=foo")).thenReturn(new WSLoaderResult<>(is, true)); loader.load("foo", mock(Function.class)); } } diff --git a/sonar-batch/src/test/java/org/sonar/batch/repository/QualityProfileProviderTest.java b/sonar-batch/src/test/java/org/sonar/batch/repository/QualityProfileProviderTest.java index 45a1ddb1579..e2acf2276f4 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/repository/QualityProfileProviderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/repository/QualityProfileProviderTest.java @@ -73,7 +73,7 @@ public class QualityProfileProviderTest { when(key.get()).thenReturn("project"); when(projectRepo.exists()).thenReturn(true); - response = new ArrayList<QualityProfile>(1); + response = new ArrayList<>(1); response.add(QualityProfile.newBuilder().setKey("profile").setName("profile").setLanguage("lang").build()); } diff --git a/sonar-batch/src/test/java/org/sonar/batch/rule/DefaultActiveRulesLoaderTest.java b/sonar-batch/src/test/java/org/sonar/batch/rule/DefaultActiveRulesLoaderTest.java index ac84b8ea2fa..eb8f6971046 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/rule/DefaultActiveRulesLoaderTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/rule/DefaultActiveRulesLoaderTest.java @@ -53,8 +53,8 @@ public class DefaultActiveRulesLoaderTest { String req1 = "/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=c%2B-test_c%2B-values-17445&p=1&ps=500"; String req2 = "/api/rules/search.protobuf?f=repo,name,severity,lang,internalKey,templateKey,params,actives&activation=true&qprofile=c%2B-test_c%2B-values-17445&p=2&ps=500"; - when(ws.loadStream(req1)).thenReturn(new WSLoaderResult<InputStream>(response1, false)); - when(ws.loadStream(req2)).thenReturn(new WSLoaderResult<InputStream>(response2, false)); + when(ws.loadStream(req1)).thenReturn(new WSLoaderResult<>(response1, false)); + when(ws.loadStream(req2)).thenReturn(new WSLoaderResult<>(response2, false)); Collection<LoadedActiveRule> activeRules = loader.load("c+-test_c+-values-17445", null); assertThat(activeRules).hasSize(226); diff --git a/sonar-batch/src/test/java/org/sonar/batch/source/CodeColorizersTest.java b/sonar-batch/src/test/java/org/sonar/batch/source/CodeColorizersTest.java index 3aa635172b0..b62eee31622 100644 --- a/sonar-batch/src/test/java/org/sonar/batch/source/CodeColorizersTest.java +++ b/sonar-batch/src/test/java/org/sonar/batch/source/CodeColorizersTest.java @@ -195,7 +195,7 @@ public class CodeColorizersTest { public class WebCodeColorizerFormat extends CodeColorizerFormat { - private final List<Tokenizer> tokenizers = new ArrayList<Tokenizer>(); + private final List<Tokenizer> tokenizers = new ArrayList<>(); public WebCodeColorizerFormat() { super("web"); |