fix for out of bounds exception

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@5264 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
lotus 16 years ago
parent ffed5fc415
commit 603282bcf4

@ -475,13 +475,13 @@ public class Network {
final int lastSemicolon = userAgent.lastIndexOf(';'); final int lastSemicolon = userAgent.lastIndexOf(';');
final int firstClosedParenthesis = userAgent.indexOf(')'); final int firstClosedParenthesis = userAgent.indexOf(')');
if (lastSemicolon > 0) { if (lastSemicolon < firstClosedParenthesis) {
// ; Location ) // ; Location )
location = (firstClosedParenthesis > 0) ? userAgent.substring(lastSemicolon + 1, firstClosedParenthesis) location = (firstClosedParenthesis > 0) ? userAgent.substring(lastSemicolon + 1, firstClosedParenthesis)
.trim() : userAgent.substring(lastSemicolon + 1).trim(); .trim() : userAgent.substring(lastSemicolon + 1).trim();
} else { } else {
if (firstOpenParenthesis > 0) { if (firstOpenParenthesis < userAgent.length()) {
if (firstClosedParenthesis > 0) { if (firstClosedParenthesis > firstOpenParenthesis) {
// ( Location ) // ( Location )
location = userAgent.substring(firstOpenParenthesis + 1, firstClosedParenthesis).trim(); location = userAgent.substring(firstOpenParenthesis + 1, firstClosedParenthesis).trim();
} else { } else {

Loading…
Cancel
Save