Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
- fix for missing favicons in search widgets - fix for bad digest/hash computation in case of interrupts to class
orbiterdec4f36700ad
diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.javaindex e16eead4f..d6ef85b74 100644--- a/htroot/yacysearchitem.java+++ b/htroot/yacysearchitem.java@@ -75,7 +75,9 @@ public class yacysearchitem {prop.put("references", "0");prop.put("rssreferences", "0");prop.put("dynamic", "0");- boolean isHtml = header.get(HeaderFramework.CONNECTION_PROP_PATH).endsWith(".html");+ String p = header.get(HeaderFramework.CONNECTION_PROP_PATH);+ boolean isHtml = p.endsWith(".html");+ boolean isJson = p.endsWith(".json");// find search eventfinal SearchEvent theSearch = SearchEventCache.getEvent(eventID);@@ -108,7 +110,7 @@ public class yacysearchitem {DigestURI resultURL = result.url();final int port = resultURL.getPort();DigestURI faviconURL = null;- if (isHtml && !sb.isIntranetMode() && !resultURL.isLocal()) try {+ if ((isHtml || isJson) && !sb.isIntranetMode() && !resultURL.isLocal()) try {faviconURL = new DigestURI(resultURL.getProtocol() + "://" + resultURL.getHost() + ((port != -1) ? (":" + port) : "") + "/favicon.ico");} catch (final MalformedURLException e1) {Log.logException(e1);diff --git a/source/de/anomic/tools/cryptbig.java b/source/de/anomic/tools/cryptbig.javaindex 4f8b37cef..a54093220 100644--- a/source/de/anomic/tools/cryptbig.java+++ b/source/de/anomic/tools/cryptbig.java@@ -636,7 +636,12 @@ public class cryptbig {if (s[0].equals("-md5")) {// generate a public key from a password that can be used for encryptionif (s.length != 2) {help(); System.exit(-1);}- final String md5s = Digest.encodeMD5Hex(new File(s[1]));+ String md5s = "";+ try {+ md5s = Digest.encodeMD5Hex(new File(s[1]));+ } catch (IOException e) {+ e.printStackTrace();+ }System.out.println(md5s);System.exit(0);}diff --git a/source/net/yacy/kelondro/order/Digest.java b/source/net/yacy/kelondro/order/Digest.javaindex 520479a6b..616bf63ce 100644--- a/source/net/yacy/kelondro/order/Digest.java+++ b/source/net/yacy/kelondro/order/Digest.java@@ -102,7 +102,7 @@ public class Digest {return encodeHex(encodeMD5Raw(key));}- public static String encodeMD5Hex(final File file) {+ public static String encodeMD5Hex(final File file) throws IOException {// generate a hex representation from the md5 of a filereturn encodeHex(encodeMD5Raw(file));}@@ -145,7 +145,7 @@ public class Digest {return result;}- public static byte[] encodeMD5Raw(final File file) {+ public static byte[] encodeMD5Raw(final File file) throws IOException {FileInputStream in;try {in = new FileInputStream(file);@@ -166,15 +166,16 @@ public class Digest {try {while (true) {c = md5consumer.nextFree();+ if (c == null) throw new IOException("c == null, probably interrupted");c.n = in.read(c.b);if (c.n <= 0) break;md5consumer.consume(c);}in.close();} catch (final IOException e) {- System.out.println("file error with " + file.toString() + ": " + e.getMessage());+ Log.logSevere("Digest", "file error with " + file.toString() + ": " + e.getMessage());md5consumer.consume(md5FilechunkConsumer.poison);- return null;+ throw e;}// put in poison into queue to tell the consumer to stopmd5consumer.consume(md5FilechunkConsumer.poison);@@ -184,10 +185,11 @@ public class Digest {return md5result.get().digest();} catch (InterruptedException e) {Log.logException(e);+ throw new IOException(e);} catch (ExecutionException e) {Log.logException(e);+ throw new IOException(e);}- return null;}private static class filechunk {@@ -228,12 +230,12 @@ public class Digest {}}- public filechunk nextFree() {+ public filechunk nextFree() throws IOException {try {return empty.take();} catch (InterruptedException e) {Log.logException(e);- return null;+ throw new IOException(e);}}@@ -357,7 +359,11 @@ public class Digest {if (s[0].equals("-md5")) {// generate a md5 from a given fileFile f = new File(s[1]);- System.out.println("MD5 (" + f.getName() + ") = " + encodeMD5Hex(f));+ try {+ System.out.println("MD5 (" + f.getName() + ") = " + encodeMD5Hex(f));+ } catch (IOException e) {+ e.printStackTrace();+ }}if (s[0].equals("-fhex")) {