From: Simon Brandhof Date: Wed, 19 Jul 2017 15:00:39 +0000 (+0200) Subject: WS batch/issues must return 400 if requested component type is not supported X-Git-Tag: 6.6-RC1~864 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ec9ac9441625bdc759626d305cd1e858666fb646;p=sonarqube.git WS batch/issues must return 400 if requested component type is not supported --- diff --git a/server/sonar-server/src/main/java/org/sonar/server/batch/IssuesAction.java b/server/sonar-server/src/main/java/org/sonar/server/batch/IssuesAction.java index d53b87ea481..d7f79bf0e3d 100644 --- a/server/sonar-server/src/main/java/org/sonar/server/batch/IssuesAction.java +++ b/server/sonar-server/src/main/java/org/sonar/server/batch/IssuesAction.java @@ -102,7 +102,7 @@ public class IssuesAction implements BatchWsAction { break; default: // only projects, modules and files are supported. Other types of components are not allowed. - throw new IllegalStateException(format("Component of scope '%s' is not allowed", component.scope())); + throw new IllegalArgumentException(format("Component of scope '%s' is not allowed", component.scope())); } } } diff --git a/server/sonar-server/src/test/java/org/sonar/server/batch/IssuesActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/batch/IssuesActionTest.java index 746bce1adfb..b3d9f40c408 100644 --- a/server/sonar-server/src/test/java/org/sonar/server/batch/IssuesActionTest.java +++ b/server/sonar-server/src/test/java/org/sonar/server/batch/IssuesActionTest.java @@ -202,7 +202,7 @@ public class IssuesActionTest { ComponentDto directory = db.components().insertComponent(newDirectory(project, "src/main/java")); addPermissionTo(project); - expectedException.expect(IllegalStateException.class); + expectedException.expect(IllegalArgumentException.class); expectedException.expectMessage("Component of scope 'DIR' is not allowed"); call(directory.key());