]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13341 improved error message
authorMichal Duda <michal.duda@sonarsource.com>
Wed, 1 Jul 2020 11:45:33 +0000 (13:45 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 1 Jul 2020 20:05:54 +0000 (20:05 +0000)
server/sonar-webserver-webapi/src/main/java/org/sonar/server/webhook/ws/WebhookSupport.java
server/sonar-webserver-webapi/src/test/java/org/sonar/server/webhook/ws/WebhookSupportTest.java

index 013dbcb58e83574ff543b3237dc7276b826fa450..7e4b33130005e4a455ca1e590869c622e4648485 100644 (file)
@@ -60,7 +60,7 @@ public class WebhookSupport {
       InetAddress address = InetAddress.getByName(okUrl.host());
       if (configuration.getBoolean(SONAR_VALIDATE_WEBHOOKS.getKey()).orElse(true)
         && (address.isLoopbackAddress() || address.isAnyLocalAddress())) {
-        throw new IllegalArgumentException("Invalid URL");
+        throw new IllegalArgumentException("Invalid URL: loopback and wildcard addresses are not allowed for webhooks.");
       }
     } catch (UnknownHostException e) {
       // if a host can not be resolved the deliveries will fail - no need to block it from being set
index eb9980e98a3d31a8531a4665f0ac5d8a452e192e..1522405d3dafcd8d64600e08ed14ce16fcc89602 100644 (file)
@@ -78,7 +78,7 @@ public class WebhookSupportTest {
   public void checkUrlPatternFailsForLoopbackAddress(String url) {
     assertThatThrownBy(() -> underTest.checkUrlPattern(url, "msg"))
       .isInstanceOf(IllegalArgumentException.class)
-      .hasMessage("Invalid URL");
+      .hasMessage("Invalid URL: loopback and wildcard addresses are not allowed for webhooks.");
   }
 
   @Test