]> source.dussan.org Git - sonarqube.git/commitdiff
WS batch/issues must return 400 if requested component type is not supported
authorSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 19 Jul 2017 15:00:39 +0000 (17:00 +0200)
committerSimon Brandhof <simon.brandhof@sonarsource.com>
Wed, 19 Jul 2017 18:47:45 +0000 (20:47 +0200)
server/sonar-server/src/main/java/org/sonar/server/batch/IssuesAction.java
server/sonar-server/src/test/java/org/sonar/server/batch/IssuesActionTest.java

index d53b87ea481e89eb79db7e603f3d4e03678d10ae..d7f79bf0e3dfdbbb91977cecbe93195663ef32e3 100644 (file)
@@ -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()));
       }
     }
   }
index 746bce1adfb70eba6d5c2436b83403af570541b6..b3d9f40c40827c2c66ae74b88077b02d41f6ac25 100644 (file)
@@ -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());