Skip to content

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

catch ip-format exception on wrong server access setting ip filter as reported in http://mantis.tokeek.de/view.php?id=713 to prevent abort of initialization. This jetty/whitelist ipaccesshandler accepts currently only ipv4

reger3151cda3a5fd
diff --git a/source/net/yacy/http/Jetty9HttpServerImpl.java b/source/net/yacy/http/Jetty9HttpServerImpl.java
index f31747951..bea74f68f 100644
--- a/source/net/yacy/http/Jetty9HttpServerImpl.java
+++ b/source/net/yacy/http/Jetty9HttpServerImpl.java
@@ -205,12 +205,16 @@ public class Jetty9HttpServerImpl implements YaCyHttpServer {
int i=0;
while (st.hasMoreTokens()) {
String ip = st.nextToken();
- iphandler.addWhite(ip);
+ try {
+ iphandler.addWhite(ip); // accepts only ipv4
+ } catch (IllegalArgumentException nex) { // catch number format exception on non ipv4 input
+ ConcurrentLog.severe("SERVER", "Server Access Settings - IP filter: " + nex.getMessage());
+ continue;
+ }
i++;
}
if (i > 0) {
iphandler.addWhite("127.0.0.1"); // allow localhost (loopback addr)
- iphandler.setServer(server);
iphandler.setHandler(crashHandler);
server.setHandler(iphandler);
ConcurrentLog.info("SERVER","activated IP access restriction to: [127.0.0.1," + white +"] (this works only correct with start parameter -Djava.net.preferIPv4Stack=true)");