|
|
@ -106,8 +106,12 @@ public class URL {
|
|
|
|
if (baseURL == null) throw new MalformedURLException("base URL is null");
|
|
|
|
if (baseURL == null) throw new MalformedURLException("base URL is null");
|
|
|
|
int p = relPath.indexOf(':');
|
|
|
|
int p = relPath.indexOf(':');
|
|
|
|
String relprotocol = (p < 0) ? null : relPath.substring(0, p).toLowerCase();
|
|
|
|
String relprotocol = (p < 0) ? null : relPath.substring(0, p).toLowerCase();
|
|
|
|
if ((relprotocol != null) && ("http.https.ftp.mailto".indexOf(relprotocol) >= 0)) {
|
|
|
|
if (relprotocol != null) {
|
|
|
|
|
|
|
|
if ("http.https.ftp.mailto".indexOf(relprotocol) >= 0) {
|
|
|
|
parseURLString(relPath);
|
|
|
|
parseURLString(relPath);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
throw new MalformedURLException("unknown protocol: " + relprotocol);
|
|
|
|
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
this.protocol = baseURL.protocol;
|
|
|
|
this.protocol = baseURL.protocol;
|
|
|
|
this.host = baseURL.host;
|
|
|
|
this.host = baseURL.host;
|
|
|
@ -313,7 +317,9 @@ public class URL {
|
|
|
|
new String[]{"http://www.anomic.de/home/index.html", "http://www.yacy.net/test"},
|
|
|
|
new String[]{"http://www.anomic.de/home/index.html", "http://www.yacy.net/test"},
|
|
|
|
new String[]{"http://www.anomic.de/home/index.html", "ftp://ftp.yacy.net/test"},
|
|
|
|
new String[]{"http://www.anomic.de/home/index.html", "ftp://ftp.yacy.net/test"},
|
|
|
|
new String[]{"http://www.anomic.de/home/index.html", "../test"},
|
|
|
|
new String[]{"http://www.anomic.de/home/index.html", "../test"},
|
|
|
|
new String[]{"http://www.anomic.de/home/index.html", "mailto:abcdefg@nomailnomail.com"}
|
|
|
|
new String[]{"http://www.anomic.de/home/index.html", "mailto:abcdefg@nomailnomail.com"},
|
|
|
|
|
|
|
|
new String[]{null, "news:de.test"},
|
|
|
|
|
|
|
|
new String[]{"http://www.anomic.de/home", "news:de.test"}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
String environment, url;
|
|
|
|
String environment, url;
|
|
|
|
de.anomic.net.URL aURL = null;
|
|
|
|
de.anomic.net.URL aURL = null;
|
|
|
@ -321,19 +327,20 @@ public class URL {
|
|
|
|
for (int i = 0; i < test.length; i++) {
|
|
|
|
for (int i = 0; i < test.length; i++) {
|
|
|
|
environment = test[i][0];
|
|
|
|
environment = test[i][0];
|
|
|
|
url = test[i][1];
|
|
|
|
url = test[i][1];
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (environment == null) {
|
|
|
|
if (environment == null) {
|
|
|
|
aURL = new de.anomic.net.URL(url);
|
|
|
|
try {aURL = new de.anomic.net.URL(url);} catch (MalformedURLException e) {aURL = null;}
|
|
|
|
jURL = new java.net.URL(url);
|
|
|
|
try {jURL = new java.net.URL(url);} catch (MalformedURLException e) {jURL = null;}
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
aURL = new de.anomic.net.URL(new de.anomic.net.URL(environment), url);
|
|
|
|
try {aURL = new de.anomic.net.URL(new de.anomic.net.URL(environment), url);} catch (MalformedURLException e) {aURL = null;}
|
|
|
|
jURL = new java.net.URL(new java.net.URL(environment), url);
|
|
|
|
try {jURL = new java.net.URL(new java.net.URL(environment), url);} catch (MalformedURLException e) {jURL = null;}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} catch (MalformedURLException e) {
|
|
|
|
if (((aURL == null) && (jURL != null)) ||
|
|
|
|
e.printStackTrace();
|
|
|
|
((aURL != null) && (jURL == null)) ||
|
|
|
|
}
|
|
|
|
((aURL != null) && (jURL != null) && (!(jURL.toString().equals(aURL.toString()))))) {
|
|
|
|
if (!(aURL.toString().equals(jURL.toString()))) {
|
|
|
|
System.out.println("Difference for environment=" + environment + ", url=" + url + ":");
|
|
|
|
System.out.println("Difference for environment=" + environment + ", url=" + url + ":\njURL=" + jURL.toString() + "\naURL=" + aURL.toString() + "\n");
|
|
|
|
System.out.println((jURL == null) ? "jURL rejected input" : "jURL=" + jURL.toString());
|
|
|
|
|
|
|
|
System.out.println((aURL == null) ? "aURL rejected input" : "aURL=" + aURL.toString());
|
|
|
|
|
|
|
|
System.out.println();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|