Hi,
Find attached diff of bug fix for -- StringOutOfBoundsException while trying
to connect to a URL.
Bug is found and fixed in
"/libraries/javalib/kaffe/net/www/protocol/http/HttpURLConnection.java" of
Kaffe-snap-20010819.
In brief -- I found out that testing for end of string is not done when
reading header, which could lead to StringOutOfBoundsException.
Thanks & regards,
Santosh.
---
/data/kaffesrc/kaffe-snap-20010819/libraries/javalib/kaffe/net/www/protocol/http/HttpURLConnection_old.java
Mon Nov 26 09:57:46 2001
+++
+/data/kaffesrc/kaffe-snap-20010819/libraries/javalib/kaffe/net/www/protocol/http/HttpURLConnection.java
+ Wed Nov 21 08:56:37 2001
@@ -159,9 +159,20 @@
int pos = line.indexOf(':');
if (pos > 0) {
String key = line.substring(0, pos);
- for (pos++; Character.isWhitespace(line.charAt(pos));
pos++)
+ // Modified to handle cases where the line ends in ':'
+which could lead to StringIndexOutOfBoundsException. Modified date 20th Nov 2001.
+ //for (pos++;
+Character.isWhitespace(line.charAt(pos)); pos++)
+ for (pos++; (pos < line.length()) &&
+Character.isWhitespace(line.charAt(pos)); pos++)
;
- String val = line.substring(pos);
+ // Modified to handle cases where the line ends in ':'
+which could lead to StringIndexOutOfBoundsException. Modified date 20th Nov 2001.
+ //String val = line.substring(pos);
+ String val;
+ if(pos < line.length()) {
+ val = line.substring(pos);
+ }
+ else {
+ val = "";
+ }
+ // due to above modification on 20th Nov 2001 there
+may be a case where val could result in ""; NO idea about the consequence of this and
+whether this corresponds to Http-Specifications (zero-length string as value for a
+header).
setHeaderField(key, val);
}
}
-----------------------------------------------------------------------------------------------------------------------
Information transmitted by this E-MAIL is proprietary to Wipro and/or its Customers and
is intended for use only by the individual or entity to which it is
addressed, and may contain information that is privileged, confidential or
exempt from disclosure under applicable law. If you are not the intended
recipient or it appears that this mail has been forwarded to you without
proper authority, you are notified that any use or dissemination of this
information in any manner is strictly prohibited. In such cases, please
notify us immediately at mailto:[EMAIL PROTECTED] and delete this mail
from your records.
------------------------------------------------------------------------------------------------------------------------