Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
log missing seed.port in favour of exception to prevent repeating throws
reger7ed812a2bf25
diff --git a/source/net/yacy/peers/Seed.java b/source/net/yacy/peers/Seed.javaindex bc9d64385..f19cd17b7 100644--- a/source/net/yacy/peers/Seed.java+++ b/source/net/yacy/peers/Seed.java@@ -750,15 +750,12 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>* generate a public address using a given ip. This combines the ip with the port and encloses the ip* with square brackets if the ip is of typeIPv6* @param ip- * @return an address string which can be used as host:port part of an url+ * @return an address string which can be used as host:port part of an url (if no port avail returns just host)*/public final String getPublicAddress(final String ip) {if (ip == null) throw new RuntimeException("ip == NULL"); // that should not happenfinal String port = this.dna.get(Seed.PORT); // we do not use getPort() here to avoid String->Integer->toString() conversion- if ( port == null || port.length() < 2 || port.length() > 5 ) {- throw new RuntimeException("port not wellformed: " + port); // that should not happen- }- final StringBuilder sb = new StringBuilder(ip.length() + port.length() + 3);+ final StringBuilder sb = new StringBuilder(ip.length() + 8); // / = surplus for portif (ip.indexOf(':') >= 0) {if (!ip.startsWith("[")) sb.append('[');sb.append(ip);@@ -766,8 +763,13 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>} else {sb.append(ip);}- sb.append(':');- sb.append(port);+ if (port == null || port.length() < 2 || port.length() > 5) {+ //just skip port if peer didn't report it..... may finally depart+ Network.log.severe("port not wellformed for peer" + this.getName() + ": " + port == null ? "null" : port);+ } else {+ sb.append(':');+ sb.append(port);+ }return sb.toString();}