*) No stacktrace anymore if invalid regex is entered for URL mask or Prefer mask, insted an error message gets displayed.

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3529 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
low012 18 years ago
parent 1b7fda12ee
commit f603b58f6c

@ -88,6 +88,8 @@ document.getElementById("Enter").value = "search again - catch up more links";
then please run your own peer and start a crawl of your wanted information to make it then please run your own peer and start a crawl of your wanted information to make it
available for everyone. Then stay online to support crawls from other peers. Thank you!</p> available for everyone. Then stay online to support crawls from other peers. Thank you!</p>
:: ::
<p>No Results. &quot;<strong>#[wrong_regex]#</strong>&quot; is no valid regular expression, please go back to the previous page and make sure to enter a valid regular expressions for URL mask and Prefer mask.</p>
::
<p><strong>#[linkcount]#</strong> results from <strong>#[orderedcount]#</strong> ordered links from <strong>#[filteredcount]#</strong> filtered links of a total number of <strong>#[totalcount]#</strong> known.</p> <p><strong>#[linkcount]#</strong> results from <strong>#[orderedcount]#</strong> ordered links from <strong>#[filteredcount]#</strong> filtered links of a total number of <strong>#[totalcount]#</strong> known.</p>
#(/num-results)# #(/num-results)#

@ -52,6 +52,7 @@ import java.net.MalformedURLException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.regex.PatternSyntaxException;
import java.util.TreeSet; import java.util.TreeSet;
import de.anomic.htmlFilter.htmlFilterImageEntry; import de.anomic.htmlFilter.htmlFilterImageEntry;
@ -267,8 +268,16 @@ public class yacysearch {
plasmaSearchRankingProfile ranking = (sb.getConfig("rankingProfile", "").length() == 0) ? new plasmaSearchRankingProfile(contentdomString) : new plasmaSearchRankingProfile("", crypt.simpleDecode(sb.getConfig("rankingProfile", ""), null)); plasmaSearchRankingProfile ranking = (sb.getConfig("rankingProfile", "").length() == 0) ? new plasmaSearchRankingProfile(contentdomString) : new plasmaSearchRankingProfile("", crypt.simpleDecode(sb.getConfig("rankingProfile", ""), null));
plasmaSearchTimingProfile localTiming = new plasmaSearchTimingProfile(4 * thisSearch.maximumTime / 10, thisSearch.wantedResults); plasmaSearchTimingProfile localTiming = new plasmaSearchTimingProfile(4 * thisSearch.maximumTime / 10, thisSearch.wantedResults);
plasmaSearchTimingProfile remoteTiming = new plasmaSearchTimingProfile(6 * thisSearch.maximumTime / 10, thisSearch.wantedResults); plasmaSearchTimingProfile remoteTiming = new plasmaSearchTimingProfile(6 * thisSearch.maximumTime / 10, thisSearch.wantedResults);
plasmaSearchResults results = sb.searchFromLocal(thisSearch, ranking, localTiming, remoteTiming, true, (String) header.get("CLIENTIP")); plasmaSearchResults results = new plasmaSearchResults();
String wrongregex = null;
try{
results = sb.searchFromLocal(thisSearch, ranking, localTiming, remoteTiming, true, (String) header.get("CLIENTIP"));
}
catch(PatternSyntaxException e){
wrongregex = e.getPattern();
}
//prop=sb.searchFromLocal(thisSearch, ranking, localTiming, remoteTiming, true, (String) header.get("CLIENTIP")); //prop=sb.searchFromLocal(thisSearch, ranking, localTiming, remoteTiming, true, (String) header.get("CLIENTIP"));
prop=new serverObjects(); prop=new serverObjects();
//prop.put("references", 0); //prop.put("references", 0);
@ -395,15 +404,23 @@ public class yacysearch {
} }
} }
} else { } else {
if (totalcount == 0) { if (wrongregex != null) {
prop.put("num-results", 3); // long prop.put("num-results_wrong_regex", wrongregex);
} else {
prop.put("num-results", 4); prop.put("num-results", 4);
} }
else if (totalcount == 0) {
prop.put("num-results", 3); // long
}
else {
prop.put("num-results", 5);
}
} }
} }
if (yacyonline) { if (wrongregex != null) {
prop.put("type_resultbottomline", 0);
}
else if (yacyonline) {
if (global) { if (global) {
prop.put("type_resultbottomline", 1); prop.put("type_resultbottomline", 1);
prop.put("type_resultbottomline_globalresults", prop.get("num-results_globalresults", "0")); prop.put("type_resultbottomline_globalresults", prop.get("num-results_globalresults", "0"));

Loading…
Cancel
Save