diff options
author | Simon Brandhof <simon.brandhof@gmail.com> | 2013-04-07 22:43:12 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@gmail.com> | 2013-04-07 22:43:12 +0200 |
commit | 6c7937c683da38f7d87ce4e7064707ceea95e7ff (patch) | |
tree | 07d5a5bc6c75280c912428ab761f39f559e3ed43 /sonar-runner-impl | |
parent | 3258f16877c32accda2a1a7aec1a2114068b3bab (diff) | |
download | sonar-scanner-cli-6c7937c683da38f7d87ce4e7064707ceea95e7ff.tar.gz sonar-scanner-cli-6c7937c683da38f7d87ce4e7064707ceea95e7ff.zip |
Fix fork of JVM when an argument is blank
Diffstat (limited to 'sonar-runner-impl')
6 files changed, 9 insertions, 9 deletions
diff --git a/sonar-runner-impl/src/main/java/org/sonar/runner/impl/JarExtractor.java b/sonar-runner-impl/src/main/java/org/sonar/runner/impl/JarExtractor.java index caa419b..f264cd1 100644 --- a/sonar-runner-impl/src/main/java/org/sonar/runner/impl/JarExtractor.java +++ b/sonar-runner-impl/src/main/java/org/sonar/runner/impl/JarExtractor.java @@ -26,7 +26,7 @@ import java.net.URL; public class JarExtractor { - public File extract(String filenameWithoutSuffix) { + public File extractToTemp(String filenameWithoutSuffix) { String filename = filenameWithoutSuffix + ".jar"; URL url = getClass().getResource("/" + filename); try { diff --git a/sonar-runner-impl/src/main/java/org/sonar/runner/impl/Jars30.java b/sonar-runner-impl/src/main/java/org/sonar/runner/impl/Jars30.java index f4d9848..42bea55 100644 --- a/sonar-runner-impl/src/main/java/org/sonar/runner/impl/Jars30.java +++ b/sonar-runner-impl/src/main/java/org/sonar/runner/impl/Jars30.java @@ -33,7 +33,7 @@ class Jars30 { List<File> download(File workDir, JarExtractor jarExtractor) { List<File> files = new ArrayList<File>(); - files.add(jarExtractor.extract("sonar-runner-batch")); + files.add(jarExtractor.extractToTemp("sonar-runner-batch")); files.addAll(downloadFiles(workDir)); return files; } diff --git a/sonar-runner-impl/src/main/java/org/sonar/runner/impl/Jars35.java b/sonar-runner-impl/src/main/java/org/sonar/runner/impl/Jars35.java index 0c03a4f..18f7415 100644 --- a/sonar-runner-impl/src/main/java/org/sonar/runner/impl/Jars35.java +++ b/sonar-runner-impl/src/main/java/org/sonar/runner/impl/Jars35.java @@ -54,7 +54,7 @@ class Jars35 { List<File> download() { List<File> files = new ArrayList<File>(); - files.add(jarExtractor.extract("sonar-runner-batch")); + files.add(jarExtractor.extractToTemp("sonar-runner-batch")); files.addAll(dowloadFiles()); return files; } diff --git a/sonar-runner-impl/src/test/java/org/sonar/runner/impl/JarExtractorTest.java b/sonar-runner-impl/src/test/java/org/sonar/runner/impl/JarExtractorTest.java index 3cc1247..594590c 100644 --- a/sonar-runner-impl/src/test/java/org/sonar/runner/impl/JarExtractorTest.java +++ b/sonar-runner-impl/src/test/java/org/sonar/runner/impl/JarExtractorTest.java @@ -30,7 +30,7 @@ import static org.fest.assertions.Fail.fail; public class JarExtractorTest { @Test public void test_extract() throws Exception { - File jarFile = new JarExtractor().extract("fake"); + File jarFile = new JarExtractor().extractToTemp("fake"); assertThat(jarFile).isFile().exists(); assertThat(FileUtils.readFileToString(jarFile, "UTF-8")).isEqualTo("Fake jar for unit tests"); assertThat(jarFile.toURI().toURL().toString()).doesNotContain("jar:file"); @@ -39,7 +39,7 @@ public class JarExtractorTest { @Test public void should_fail_to_extract() throws Exception { try { - new JarExtractor().extract("unknown"); + new JarExtractor().extractToTemp("unknown"); fail(); } catch (IllegalStateException e) { assertThat(e).hasMessage("Fail to extract unknown.jar"); diff --git a/sonar-runner-impl/src/test/java/org/sonar/runner/impl/Jars30Test.java b/sonar-runner-impl/src/test/java/org/sonar/runner/impl/Jars30Test.java index 664e195..c67f657 100644 --- a/sonar-runner-impl/src/test/java/org/sonar/runner/impl/Jars30Test.java +++ b/sonar-runner-impl/src/test/java/org/sonar/runner/impl/Jars30Test.java @@ -48,7 +48,7 @@ public class Jars30Test { @Test public void should_download_jar_files() throws Exception { File batchJar = temp.newFile("sonar-runner-batch.jar"); - when(jarExtractor.extract("sonar-runner-batch")).thenReturn(batchJar); + when(jarExtractor.extractToTemp("sonar-runner-batch")).thenReturn(batchJar); // index of the files to download when(connection.downloadString("/batch/")).thenReturn("cpd.jar,squid.jar"); @@ -65,7 +65,7 @@ public class Jars30Test { @Test public void should_fail_to_download_files() throws Exception { File batchJar = temp.newFile("sonar-runner-batch.jar"); - when(jarExtractor.extract("sonar-runner-batch")).thenReturn(batchJar); + when(jarExtractor.extractToTemp("sonar-runner-batch")).thenReturn(batchJar); // index of files to download when(connection.downloadString("/batch/")).thenReturn("cpd.jar,squid.jar"); doThrow(new IllegalStateException()).when(connection).download(eq("/batch/squid.jar"), any(File.class)); diff --git a/sonar-runner-impl/src/test/java/org/sonar/runner/impl/Jars35Test.java b/sonar-runner-impl/src/test/java/org/sonar/runner/impl/Jars35Test.java index b0ac815..8bfcdbb 100644 --- a/sonar-runner-impl/src/test/java/org/sonar/runner/impl/Jars35Test.java +++ b/sonar-runner-impl/src/test/java/org/sonar/runner/impl/Jars35Test.java @@ -49,7 +49,7 @@ public class Jars35Test { @Test public void should_download_jar_files() throws Exception { File batchJar = temp.newFile("sonar-runner-batch.jar"); - when(jarExtractor.extract("sonar-runner-batch")).thenReturn(batchJar); + when(jarExtractor.extractToTemp("sonar-runner-batch")).thenReturn(batchJar); // index of the files to download when(connection.downloadString("/batch_bootstrap/index")).thenReturn( "cpd.jar|CA124VADFSDS\n" + @@ -70,7 +70,7 @@ public class Jars35Test { @Test public void should_fail_to_download_files() throws Exception { File batchJar = temp.newFile("sonar-runner-batch.jar"); - when(jarExtractor.extract("sonar-runner-batch")).thenReturn(batchJar); + when(jarExtractor.extractToTemp("sonar-runner-batch")).thenReturn(batchJar); // index of the files to download when(connection.downloadString("/batch_bootstrap/index")).thenThrow(new IllegalStateException()); |