bug fix for -- StringOutOfBoundsException while trying to connect to a URL.
Santosh Kumar Janmanchi
kaffe@rufus.w3.org
Mon, 26 Nov 2001 11:53:01 +0530
This is a multi-part message in MIME format.
------=_NextPart_000_005A_01C17670.E6220B10
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
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.
------=_NextPart_000_005A_01C17670.E6220B10
Content-Type: text/plain;
name="patchdiff.txt"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="patchdiff.txt"
--- =
/data/kaffesrc/kaffe-snap-20010819/libraries/javalib/kaffe/net/www/protoc=
ol/http/HttpURLConnection_old.java Mon Nov 26 09:57:46 2001=0A=
+++ =
/data/kaffesrc/kaffe-snap-20010819/libraries/javalib/kaffe/net/www/protoc=
ol/http/HttpURLConnection.java Wed Nov 21 08:56:37 2001=0A=
@@ -159,9 +159,20 @@=0A=
int pos =3D line.indexOf(':');=0A=
if (pos > 0) {=0A=
String key =3D line.substring(0, pos);=0A=
- for (pos++; Character.isWhitespace(line.charAt(pos)); pos++)=0A=
+ // Modified to handle cases where the line ends in ':' which could =
lead to StringIndexOutOfBoundsException. Modified date 20th Nov 2001.=0A=
+ //for (pos++; Character.isWhitespace(line.charAt(pos)); pos++)=0A=
+ for (pos++; (pos < line.length()) && =
Character.isWhitespace(line.charAt(pos)); pos++)=0A=
;=0A=
- String val =3D line.substring(pos);=0A=
+ // Modified to handle cases where the line ends in ':' which could =
lead to StringIndexOutOfBoundsException. Modified date 20th Nov 2001.=0A=
+ //String val =3D line.substring(pos);=0A=
+ String val;=0A=
+ if(pos < line.length()) {=0A=
+ val =3D line.substring(pos);=0A=
+ }=0A=
+ else {=0A=
+ val =3D "";=0A=
+ }=0A=
+ // 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).=0A=
setHeaderField(key, val);=0A=
}=0A=
}=0A=
------=_NextPart_000_005A_01C17670.E6220B10
Content-Type: text/plain;
name="Wipro_Disclaimer.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="Wipro_Disclaimer.txt"
-----------------------------------------------------------------------------------------------------------------------
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:mailadmin@wipro.com and delete this mail
from your records.
------------------------------------------------------------------------------------------------------------------------
------=_NextPart_000_005A_01C17670.E6220B10--