Skip to content

Commit 985f1fe

Browse files
committed
Include help link for malformed URLs
Try to hint people to use absUrl()
1 parent 6b67d05 commit 985f1fe

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/main/java/org/jsoup/helper/HttpConnection.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ public Connection url(String url) {
183183
try {
184184
req.url(new URL(encodeUrl(url)));
185185
} catch (MalformedURLException e) {
186-
throw new IllegalArgumentException(String.format("The supplied URL, '%s', is malformed. Make sure it is an absolute URL, and starts with 'http://' or 'https://'.", url), e);
186+
throw new IllegalArgumentException(String.format("The supplied URL, '%s', is malformed. Make sure it is an absolute URL, and starts with 'http://' or 'https://'. See https://jsoup.org/cookbook/extracting-data/working-with-urls", url), e);
187187
}
188188
return this;
189189
}

src/test/java/org/jsoup/helper/HttpConnectionTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ public void caseInsensitiveHeaders(Locale locale) {
306306
Jsoup.connect("jsoup.org/test");
307307
} catch (IllegalArgumentException e) {
308308
threw = true;
309-
assertEquals("The supplied URL, 'jsoup.org/test', is malformed. Make sure it is an absolute URL, and starts with 'http://' or 'https://'.", e.getMessage());
309+
assertEquals("The supplied URL, 'jsoup.org/test', is malformed. Make sure it is an absolute URL, and starts with 'http://' or 'https://'. See https://jsoup.org/cookbook/extracting-data/working-with-urls", e.getMessage());
310310
}
311311
assertTrue(threw);
312312
}

0 commit comments

Comments
 (0)