Skip to content

Commit a909600

Browse files
committed
Comment on URL normalization
1 parent 6b3ec64 commit a909600

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/main/java/org/jsoup/internal/StringUtil.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,8 @@ public static URL resolve(URL base, String relUrl) throws MalformedURLException
288288
* @return an absolute URL if one was able to be generated, or the empty string if not
289289
*/
290290
public static String resolve(final String baseUrl, final String relUrl) {
291-
URL base;
292291
try {
292+
URL base;
293293
try {
294294
base = new URL(baseUrl);
295295
} catch (MalformedURLException e) {
@@ -299,7 +299,8 @@ public static String resolve(final String baseUrl, final String relUrl) {
299299
}
300300
return resolve(base, relUrl).toExternalForm();
301301
} catch (MalformedURLException e) {
302-
// it may still be valid, just that Java doesn't have a registered stream handler for it, e.g. tel:
302+
// it may still be valid, just that Java doesn't have a registered stream handler for it, e.g. tel
303+
// we test here vs at start to normalize supported URLs (e.g. HTTP -> http)
303304
return validUriScheme.matcher(relUrl).find() ? relUrl : "";
304305
}
305306
}

0 commit comments

Comments
 (0)