Skip to content

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

fix for out of bounds exception

lotus603282bcf459
diff --git a/htroot/Network.java b/htroot/Network.java
index 966ade1bd..a9a47fbff 100644
--- a/htroot/Network.java
+++ b/htroot/Network.java
@@ -475,13 +475,13 @@ public class Network {
final int lastSemicolon = userAgent.lastIndexOf(';');
final int firstClosedParenthesis = userAgent.indexOf(')');
- if (lastSemicolon > 0) {
+ if (lastSemicolon < firstClosedParenthesis) {
// ; Location )
location = (firstClosedParenthesis > 0) ? userAgent.substring(lastSemicolon + 1, firstClosedParenthesis)
.trim() : userAgent.substring(lastSemicolon + 1).trim();
} else {
- if (firstOpenParenthesis > 0) {
- if (firstClosedParenthesis > 0) {
+ if (firstOpenParenthesis < userAgent.length()) {
+ if (firstClosedParenthesis > firstOpenParenthesis) {
// ( Location )
location = userAgent.substring(firstOpenParenthesis + 1, firstClosedParenthesis).trim();
} else {