improve yacysearchitem,

prevent allocation of String (modifyURL) if feature not used
pull/1/head
reger 10 years ago
parent 61f75d6019
commit 7e4e9f7e32

@ -146,37 +146,34 @@ public class yacysearchitem {
//prop.putHTML("content_link", resultUrlstring);
// START interaction
String modifyURL = resultUrlstring;
if (sb.getConfigBool("proxyURL.useforresults", false) && sb.getConfigBool("proxyURL", false)) {
String modifyURL = resultUrlstring;
// check if url is allowed to view
if (sb.getConfig("proxyURL.rewriteURLs", "all").equals("all")) {
modifyURL = "./proxy.html?url="+modifyURL;
}
// check if url is allowed to view
if (sb.getConfig("proxyURL.rewriteURLs", "all").equals("domainlist")) {
final String tmprewritecfg = sb.getConfig("proxyURL.rewriteURLs", "all");
if (tmprewritecfg.equals("all")) {
modifyURL = "./proxy.html?url=" + resultUrlstring;
} else if (tmprewritecfg.equals("domainlist")) { // check if url is allowed to view
try {
if (sb.crawlStacker.urlInAcceptedDomain(new DigestURL (modifyURL)) == null) {
modifyURL = "./proxy.html?url="+modifyURL;
if (sb.crawlStacker.urlInAcceptedDomain(new DigestURL(resultUrlstring)) == null) {
modifyURL = "./proxy.html?url=" + resultUrlstring;
}
} catch (final MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ConcurrentLog.logException(e);
}
if (sb.getConfig("proxyURL.rewriteURLs", "all").equals("yacy")) {
} else if (tmprewritecfg.equals("yacy")) {
try {
if ((new DigestURL (modifyURL).getHost().endsWith(".yacy"))) {
modifyURL = "./proxy.html?url="+modifyURL;
if ((new DigestURL(resultUrlstring).getHost().endsWith(".yacy"))) {
modifyURL = "./proxy.html?url=" + resultUrlstring;
}
} catch (final MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
ConcurrentLog.logException(e);
}
}
prop.putXML("content_link", modifyURL); // putXML for rss
} else {
prop.putXML("content_link", resultUrlstring); // putXML for rss
}
// prop.putHTML("content_value", Interaction.TripleGet(result.urlstring(), "http://virtual.x/hasvalue", "anonymous"));
// END interaction

Loading…
Cancel
Save