tried to fix the ipv6 problem as reported in bug

but this did not solve all problems because a bug in the apache http
client prevented that it worked. Thread dump:
Caused by: java.lang.NumberFormatException: For input string:
"1450:400c:c01:0:0:0:69"
	at
java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
	at java.lang.Integer.parseInt(Integer.java:458)
	at java.lang.Integer.parseInt(Integer.java:499)
	at org.apache.http.client.utils.URIUtils.extractHost(URIUtils.java:310)
	at
org.apache.http.impl.client.AbstractHttpClient.determineTarget(AbstractHttpClient.java:764)
	at
org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
	at net.yacy.cora.protocol.http.HTTPClient.execute(HTTPClient.java:597)
	at
net.yacy.cora.protocol.http.HTTPClient.getContentBytes(HTTPClient.java:558)
	at net.yacy.cora.protocol.http.HTTPClient.GETbytes(HTTPClient.java:341)
	at de.anomic.crawler.retrieval.HTTPLoader.load(HTTPLoader.java:131)
	at de.anomic.crawler.retrieval.HTTPLoader.load(HTTPLoader.java:74)
	at
net.yacy.repository.LoaderDispatcher.loadInternal(LoaderDispatcher.java:274)
	at net.yacy.repository.LoaderDispatcher.load(LoaderDispatcher.java:164)
	at net.yacy.repository.LoaderDispatcher.load(LoaderDispatcher.java:150)
	at
net.yacy.repository.LoaderDispatcher.loadDocument(LoaderDispatcher.java:355)
	at getpageinfo_p.respond(getpageinfo_p.java:97)
pull/1/head
Michael Peter Christen 13 years ago
parent e2f8f263e8
commit 8b0920b0b5

@ -560,7 +560,12 @@ public class MultiProtocolURI implements Serializable, Comparable<MultiProtocolU
private void identPort(final String inputURL, final int dflt) throws MalformedURLException {
// identify ref in file
final int r = this.host.indexOf(':');
int pss = 0;
int ip6 = this.host.indexOf('[');
if (ip6 >= 0 && ((ip6 = this.host.indexOf("]", ip6)) > 0)) {
pss = ip6 + 1;
}
final int r = this.host.indexOf(":", pss);
if (r < 0) {
this.port = dflt;
} else {
@ -1164,13 +1169,14 @@ public class MultiProtocolURI implements Serializable, Comparable<MultiProtocolU
return splitpattern.split(normalizedURL.toLowerCase()); // word components of the url
}
/*
public static void main(final String[] args) {
for (final String s: args) System.out.println(toTokens(s));
}
/*
*/
public static void main(final String[] args) {
final String[][] test = new String[][]{
new String[]{null, "http://[2a00:1450:400c:c01::69]/"},
new String[]{null, "C:WINDOWS\\CMD0.EXE"},
new String[]{null, "file://C:WINDOWS\\CMD0.EXE"},
new String[]{null, "file:/bin/yacy1"}, // file://<host>/<path> may have many '/' if the host is omitted and the path starts with '/'
@ -1221,9 +1227,9 @@ public class MultiProtocolURI implements Serializable, Comparable<MultiProtocolU
String environment, url;
MultiProtocolURI aURL, aURL1;
java.net.URL jURL;
for (int i = 0; i < test.length; i++) {
environment = test[i][0];
url = test[i][1];
for (String[] element : test) {
environment = element[0];
url = element[1];
try {aURL = MultiProtocolURI.newURL(environment, url);} catch (final MalformedURLException e) {e.printStackTrace(); aURL = null;}
if (environment == null) {
try {jURL = new java.net.URL(url);} catch (final MalformedURLException e) {jURL = null;}
@ -1255,6 +1261,5 @@ public class MultiProtocolURI implements Serializable, Comparable<MultiProtocolU
}
}
}
*/
}

Loading…
Cancel
Save