- fix for String index out of range during URL parsing

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3096 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
karlchenofhell 18 years ago
parent c500178fd7
commit a619ba3f49

@ -49,7 +49,7 @@ public class URL {
int p = url.indexOf(':'); int p = url.indexOf(':');
if (p < 0) throw new MalformedURLException("protocol is not given in '" + url + "'"); if (p < 0) throw new MalformedURLException("protocol is not given in '" + url + "'");
this.protocol = url.substring(0, p).toLowerCase().trim(); this.protocol = url.substring(0, p).toLowerCase().trim();
if (url.length() < p + 4) throw new MalformedURLException("URL not parseable: '" + url + "'");
if (url.substring(p + 1, p + 3).equals("//")) { if (url.substring(p + 1, p + 3).equals("//")) {
// identify host, userInfo and file for http and ftp protocol // identify host, userInfo and file for http and ftp protocol
int q = url.indexOf('/', p + 3); int q = url.indexOf('/', p + 3);

Loading…
Cancel
Save