Skip to content

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

fix 2 more servlet RuntimeException in intranet mode thrown due to seed.getIP() returning null in intranet mode (in servlets: ConfigSearchBox, Load_PHPBB3 +remove unused (const ∅) seed.IPTYPE

regerf23d8ab47b2a
diff --git a/htroot/ConfigSearchBox.java b/htroot/ConfigSearchBox.java
index eb9d953e9..37bf79ff9 100644
--- a/htroot/ConfigSearchBox.java
+++ b/htroot/ConfigSearchBox.java
@@ -34,7 +34,7 @@ public class ConfigSearchBox {
final serverObjects prop = new serverObjects();
final Switchboard sb = (Switchboard) env;
- String myaddress = sb.peers.mySeed().getPublicAddress(sb.peers.mySeed().getIP());
+ String myaddress = sb.peers.mySeed().getIP() == null ? null : sb.peers.mySeed().getPublicAddress(sb.peers.mySeed().getIP());
if (myaddress == null) myaddress = "localhost:" + sb.getLocalPort();
prop.put("myaddress", myaddress);
return prop;
diff --git a/htroot/Load_PHPBB3.java b/htroot/Load_PHPBB3.java
index e7d03398f..2674fe19c 100644
--- a/htroot/Load_PHPBB3.java
+++ b/htroot/Load_PHPBB3.java
@@ -38,7 +38,7 @@ public class Load_PHPBB3 {
final serverObjects prop = new serverObjects();
// define visible variables
- String a = sb.peers.mySeed().getPublicAddress(sb.peers.mySeed().getIP());
+ String a = sb.peers.mySeed().getIP() == null ? null : sb.peers.mySeed().getPublicAddress(sb.peers.mySeed().getIP());
if (a == null) a = "localhost:" + sb.getLocalPort();
final boolean intranet = sb.getConfig(SwitchboardConstants.NETWORK_NAME, "").equals("intranet");
final String repository = "http://" + a + "/repository/";
diff --git a/source/net/yacy/peers/Seed.java b/source/net/yacy/peers/Seed.java
index 04a31c6fb..c029c0d50 100644
--- a/source/net/yacy/peers/Seed.java
+++ b/source/net/yacy/peers/Seed.java
@@ -133,8 +133,6 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>
*/
public static final String PEERTYPE = "PeerType";
- /** static/dynamic (if the IP changes often for any reason) */
- private static final String IPTYPE = "IPType";
private static final String FLAGS = "Flags";
public static final String FLAGSZERO = " ";
@@ -262,7 +260,6 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>
// settings that is created during the 'hello' phase - in first contact
this.dna.put(Seed.IP, ""); // 123.234.345.456
this.dna.put(Seed.PORT, "&empty;");
- this.dna.put(Seed.IPTYPE, "&empty;");
// settings that can only be computed by visiting peer
this.dna.put(Seed.USPEED, Seed.ZERO); // the computated uplink speed of the peer
@@ -758,7 +755,7 @@ public class Seed implements Cloneable, Comparable<Seed>, Comparator<Seed>
* @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 happen
+ if (ip == null) throw new RuntimeException("ip == NULL"); // that should not happen in Peer-to-Peer mode (but can in Intranet mode)
final String port = this.dna.get(Seed.PORT); // we do not use getPort() here to avoid String->Integer->toString() conversion
final StringBuilder sb = new StringBuilder(ip.length() + 8); // / = surplus for port
if (ip.indexOf(':') >= 0) {