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

Loading…
Cancel
Save