This is the mail archive of the
java-prs@gcc.gnu.org
mailing list for the Java project.
[Bug libgcj/27231] New: java.lang.StringIndexOutOfBoundsException in HTTPURLConnection.connect
- From: "r_ovidius at eml dot cc" <gcc-bugzilla at gcc dot gnu dot org>
- To: java-prs at gcc dot gnu dot org
- Date: 20 Apr 2006 22:39:20 -0000
- Subject: [Bug libgcj/27231] New: java.lang.StringIndexOutOfBoundsException in HTTPURLConnection.connect
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Works in Sun's java. Doesn't work with gcj, with or without the trailing "/"
on the url.
gcj (GCC) 4.2.0 20060419 (experimental)
gcj -o Htest --main=Htest Htest.java
./Htest
Exception in thread "main" java.lang.StringIndexOutOfBoundsException
at java.lang.String.substring (libgcj.so.7)
at gnu.java.net.protocol.http.HTTPURLConnection.connect (libgcj.so.7)
at gnu.java.net.protocol.http.HTTPURLConnection.getInputStream (libgcj.so.7)
at java.net.URL.openStream (libgcj.so.7)
at Htest.main (Htest)
---
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.net.MalformedURLException;
import java.net.URL;
public class Htest {
public static void main(String[] a) {
String urlString = "http://microsoft.com/"; // w or w/o trailing "/"
URL url = null;
try {
url = new URL(urlString);
} catch (MalformedURLException e) {
e.printStackTrace();
}
try {
BufferedReader b = new BufferedReader(new
InputStreamReader(url.openStream()));
StringBuffer sb = new StringBuffer();
String string;
while ((string = b.readLine()) != null)
sb.append(string);
b.close();
System.err.println(sb.toString());
} catch (IOException e) {
e.printStackTrace();
}
}
}
--
Summary: java.lang.StringIndexOutOfBoundsException in
HTTPURLConnection.connect
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libgcj
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: r_ovidius at eml dot cc
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27231