From 156d457aeccbf1bf21e7607caf1935664a321e93 Mon Sep 17 00:00:00 2001 From: orbiter Date: Thu, 16 Aug 2012 07:47:52 +0200 Subject: [PATCH] fix for Index out of bounds exception in Network servlet --- htroot/Network.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/htroot/Network.java b/htroot/Network.java index 0354338a9..b1c675ff3 100644 --- a/htroot/Network.java +++ b/htroot/Network.java @@ -288,7 +288,7 @@ public class Network { String startURL; Map wikiMap; Map blogMap; - String userAgent, location; + String userAgent, location = ""; int PPM; double QPM; Pattern peerSearchPattern = null; @@ -368,7 +368,10 @@ public class Network { location = ClientIdentification.generateLocation(); } else { userAgent = sb.peers.peerActions.getUserAgent(seed.getIP()); - location = ClientIdentification.parseLocationInUserAgent(userAgent).substring(0, 10); + String loc = ClientIdentification.parseLocationInUserAgent(userAgent); + if (loc.length() >= 10) { + location = ClientIdentification.parseLocationInUserAgent(userAgent).substring(0, 10); + } } prop.putHTML(STR_TABLE_LIST + conCount + "_location", location); if (complete) {