aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-svn-plugin
diff options
context:
space:
mode:
authorJulien HENRY <julien.henry@sonarsource.com>2014-10-06 16:50:49 +0200
committerJulien HENRY <julien.henry@sonarsource.com>2014-10-06 16:52:28 +0200
commitf4c27bdd408300ef9205b776beca442094cfb113 (patch)
treed8c3d0294514e85a0784ab730068297bee63e106 /plugins/sonar-svn-plugin
parent944797aca4a213675ee8be000c8f5ddb41e6e003 (diff)
downloadsonarqube-f4c27bdd408300ef9205b776beca442094cfb113.tar.gz
sonarqube-f4c27bdd408300ef9205b776beca442094cfb113.zip
SONAR-5643 Unwrap exception to have better error reporting to end user
Diffstat (limited to 'plugins/sonar-svn-plugin')
-rw-r--r--plugins/sonar-svn-plugin/src/main/java/org/sonar/plugins/scm/svn/SvnBlameCommand.java11
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/sonar-svn-plugin/src/main/java/org/sonar/plugins/scm/svn/SvnBlameCommand.java b/plugins/sonar-svn-plugin/src/main/java/org/sonar/plugins/scm/svn/SvnBlameCommand.java
index 71bec9fd214..eb258af83ad 100644
--- a/plugins/sonar-svn-plugin/src/main/java/org/sonar/plugins/scm/svn/SvnBlameCommand.java
+++ b/plugins/sonar-svn-plugin/src/main/java/org/sonar/plugins/scm/svn/SvnBlameCommand.java
@@ -28,6 +28,7 @@ import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.scm.BlameCommand;
import org.sonar.api.batch.scm.BlameLine;
import org.sonar.api.utils.command.Command;
+import org.sonar.api.utils.command.CommandException;
import org.sonar.api.utils.command.CommandExecutor;
import org.sonar.api.utils.command.StreamConsumer;
import org.sonar.api.utils.command.StringStreamConsumer;
@@ -71,6 +72,7 @@ public class SvnBlameCommand implements BlameCommand, BatchComponent {
try {
task.get();
} catch (ExecutionException e) {
+ // Unwrap ExecutionException
throw e.getCause() instanceof RuntimeException ? (RuntimeException) e.getCause() : new IllegalStateException(e.getCause());
} catch (InterruptedException e) {
// Ignore
@@ -85,8 +87,13 @@ public class SvnBlameCommand implements BlameCommand, BatchComponent {
Command cl = createCommandLine(fs.baseDir(), filename);
SvnBlameConsumer consumer = new SvnBlameConsumer(filename);
StringStreamConsumer stderr = new StringStreamConsumer();
-
- int exitCode = execute(cl, consumer, stderr);
+ int exitCode;
+ try {
+ exitCode = execute(cl, consumer, stderr);
+ } catch (CommandException e) {
+ // Unwrap CommandException
+ throw e.getCause() instanceof RuntimeException ? (RuntimeException) e.getCause() : new IllegalStateException(e.getCause());
+ }
if (exitCode != 0) {
throw new IllegalStateException("The svn blame command [" + cl.toString() + "] failed: " + stderr.getOutput());
}