]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-13341 improved error message
authorMichal Duda <michal.duda@sonarsource.com>
Wed, 1 Jul 2020 09:43:29 +0000 (11:43 +0200)
committerMalena Ebert <malena.ebert@sonarsource.com>
Wed, 8 Jul 2020 10:39:43 +0000 (12:39 +0200)
server/sonar-server/src/main/java/org/sonar/server/webhook/ws/WebhookSupport.java
server/sonar-server/src/test/java/org/sonar/server/webhook/ws/WebhookSupportTest.java

index daa74e2b9c70efc672d2cc26eed2a5770fbe373a..3a6f842f715f10f107569fd428e26f6317172706 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 cca13f0a68c498a1060343eb316de6475885c7ed..49ff03b4be785b02e9706eeaf338f2d60525348a 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