From bf9a9e4e5e238babf4397814a9f6e720db2b0f2d Mon Sep 17 00:00:00 2001 From: orbiter Date: Fri, 16 Nov 2007 16:37:45 +0000 Subject: [PATCH] fix for NPE in IndexControlRWIs_p.java git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@4221 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/IndexControlRWIs_p.html | 1 - htroot/IndexControlRWIs_p.java | 41 +++++++++++++++------------------- 2 files changed, 18 insertions(+), 24 deletions(-) diff --git a/htroot/IndexControlRWIs_p.html b/htroot/IndexControlRWIs_p.html index cf4b5b49af..565b72c87a 100644 --- a/htroot/IndexControlRWIs_p.html +++ b/htroot/IndexControlRWIs_p.html @@ -159,7 +159,6 @@

Index Administration

remote links hitcount props - #{urlList}# diff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.java index 6eb51e443a..5094c70470 100644 --- a/htroot/IndexControlRWIs_p.java +++ b/htroot/IndexControlRWIs_p.java @@ -29,7 +29,6 @@ import java.io.FileWriter; import java.io.IOException; import java.io.PrintWriter; -import java.net.MalformedURLException; import java.util.Date; import java.util.HashMap; import java.util.HashSet; @@ -405,7 +404,10 @@ private static void genURLList(serverObjects prop, String keyhash, String keystr long rn = -1; while (iter.hasNext()) { entry = (indexURLEntry) iter.next(); - us = entry.comp().url().toNormalform(false, false); + if ((entry == null) || (entry.comp() == null)) continue; + url = entry.comp().url(); + if (url == null) continue; + us = url.toNormalform(false, false); if (rn == -1) rn = entry.ranking(); prop.put("genUrlList_urlList_"+i+"_urlExists", "1"); prop.put("genUrlList_urlList_"+i+"_urlExists_urlhxCount", i); @@ -415,21 +417,21 @@ private static void genURLList(serverObjects prop, String keyhash, String keystr prop.putHTML("genUrlList_urlList_"+i+"_urlExists_urlString", us); prop.put("genUrlList_urlList_"+i+"_urlExists_urlStringShort", (us.length() > 40) ? (us.substring(0, 20) + "
" + us.substring(20, 40) + "...") : ((us.length() > 30) ? (us.substring(0, 20) + "
" + us.substring(20)) : us)); prop.putNum("genUrlList_urlList_"+i+"_urlExists_ranking", (entry.ranking() - rn)); - prop.put("genUrlList_urlList_"+i+"_urlExists_domlength", yacyURL.domLengthEstimation(entry.hash())); - prop.put("genUrlList_urlList_"+i+"_urlExists_ybr", plasmaSearchRankingProcess.ybr(entry.hash())); + prop.putNum("genUrlList_urlList_"+i+"_urlExists_domlength", yacyURL.domLengthEstimation(entry.hash())); + prop.putNum("genUrlList_urlList_"+i+"_urlExists_ybr", plasmaSearchRankingProcess.ybr(entry.hash())); prop.put("genUrlList_urlList_"+i+"_urlExists_date", serverDate.shortDayTime(new Date(entry.word().lastModified()))); - prop.put("genUrlList_urlList_"+i+"_urlExists_wordsintitle", entry.word().wordsintitle()); - prop.put("genUrlList_urlList_"+i+"_urlExists_wordsintext", entry.word().wordsintext()); - prop.put("genUrlList_urlList_"+i+"_urlExists_phrasesintext", entry.word().phrasesintext()); - prop.put("genUrlList_urlList_"+i+"_urlExists_llocal", entry.word().llocal()); - prop.put("genUrlList_urlList_"+i+"_urlExists_lother", entry.word().lother()); - prop.put("genUrlList_urlList_"+i+"_urlExists_hitcount", entry.word().hitcount()); - prop.put("genUrlList_urlList_"+i+"_urlExists_worddistance", entry.word().worddistance()); - prop.put("genUrlList_urlList_"+i+"_urlExists_pos", entry.word().posintext()); - prop.put("genUrlList_urlList_"+i+"_urlExists_phrase", entry.word().posofphrase()); - prop.put("genUrlList_urlList_"+i+"_urlExists_posinphrase", entry.word().posinphrase()); - prop.put("genUrlList_urlList_"+i+"_urlExists_urlcomps", entry.word().urlcomps()); - prop.put("genUrlList_urlList_"+i+"_urlExists_urllength", entry.word().urllength()); + prop.putNum("genUrlList_urlList_"+i+"_urlExists_wordsintitle", entry.word().wordsintitle()); + prop.putNum("genUrlList_urlList_"+i+"_urlExists_wordsintext", entry.word().wordsintext()); + prop.putNum("genUrlList_urlList_"+i+"_urlExists_phrasesintext", entry.word().phrasesintext()); + prop.putNum("genUrlList_urlList_"+i+"_urlExists_llocal", entry.word().llocal()); + prop.putNum("genUrlList_urlList_"+i+"_urlExists_lother", entry.word().lother()); + prop.putNum("genUrlList_urlList_"+i+"_urlExists_hitcount", entry.word().hitcount()); + prop.putNum("genUrlList_urlList_"+i+"_urlExists_worddistance", entry.word().worddistance()); + prop.putNum("genUrlList_urlList_"+i+"_urlExists_pos", entry.word().posintext()); + prop.putNum("genUrlList_urlList_"+i+"_urlExists_phrase", entry.word().posofphrase()); + prop.putNum("genUrlList_urlList_"+i+"_urlExists_posinphrase", entry.word().posinphrase()); + prop.putNum("genUrlList_urlList_"+i+"_urlExists_urlcomps", entry.word().urlcomps()); + prop.putNum("genUrlList_urlList_"+i+"_urlExists_urllength", entry.word().urllength()); prop.put("genUrlList_urlList_"+i+"_urlExists_props", ((entry.word().flags().get(plasmaCondenser.flag_cat_indexof)) ? "appears on index page, " : "") + ((entry.word().flags().get(plasmaCondenser.flag_cat_hasimage)) ? "contains images, " : "") + @@ -444,13 +446,6 @@ private static void genURLList(serverObjects prop, String keyhash, String keystr ((entry.word().flags().get(indexRWIEntry.flag_app_emphasized)) ? "appears emphasized, " : "") + ((yacyURL.probablyRootURL(entry.word().urlHash())) ? "probably root url" : "") ); - prop.put("genUrlList_urlList_"+i+"_urlExists_phrase", entry.word().posofphrase()); - prop.put("genUrlList_urlList_"+i+"_urlExists_phrase", entry.word().posofphrase()); - try { - url = new yacyURL(us, null); - } catch (MalformedURLException e) { - url = null; - } if (plasmaSwitchboard.urlBlacklist.isListed(plasmaURLPattern.BLACKLIST_DHT, url)) { prop.put("genUrlList_urlList_"+i+"_urlExists_urlhxChecked", "1"); }