Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

hack to increase speed of url hash computation

orbitera36fda991e8f
diff --git a/source/net/yacy/kelondro/data/meta/DigestURI.java b/source/net/yacy/kelondro/data/meta/DigestURI.java
index fb3f56a8e..184689e02 100644
--- a/source/net/yacy/kelondro/data/meta/DigestURI.java
+++ b/source/net/yacy/kelondro/data/meta/DigestURI.java
@@ -248,7 +248,13 @@ public class DigestURI extends MultiProtocolURI implements Serializable {
}
private static final String hosthash5(final String protocol, final String host, final int port) {
- return Base64Order.enhancedCoder.encode(Digest.encodeMD5Raw(protocol + ((host == null) ? "" : (":" + host + ":" + port)))).substring(0, 5);
+ if (host == null) {
+ return Base64Order.enhancedCoder.encode(Digest.encodeMD5Raw(protocol)).substring(0, 5);
+ } else {
+ StringBuilder sb = new StringBuilder(host.length() + 15);
+ sb.append(protocol).append(':').append(host).append(':').append(Integer.toString(port));
+ return Base64Order.enhancedCoder.encode(Digest.encodeMD5Raw(sb.toString())).substring(0, 5);
+ }
}
/**
diff --git a/source/net/yacy/kelondro/util/FileUtils.java b/source/net/yacy/kelondro/util/FileUtils.java
index 8bca3ee11..cd0c1c223 100644
--- a/source/net/yacy/kelondro/util/FileUtils.java
+++ b/source/net/yacy/kelondro/util/FileUtils.java
@@ -155,7 +155,7 @@ public final class FileUtils {
} catch (final Exception e) {
// an "sun.io.MalformedInputException: Missing byte-order mark" - exception may occur here
//Log.logException(e);
- throw new IOException(e.getMessage() == null ? e.toString() : e.getMessage(), e);
+ throw new IOException(e == null ? "null" : e.getMessage() == null ? e.toString() : e.getMessage(), e);
}
return count;
}