Name: gm110360 Date: 06/28/2004
FULL PRODUCT VERSION :
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]
A DESCRIPTION OF THE PROBLEM :
When I tried to get the response code of a conection using the HttpUrlConnection class (java 1.5.0) of an specif and valid url ( http://www.scielo.br/gmb.htm ) I got an Runtime exception.
When I complied and executed the same program with :
java version "1.4.2_03"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-b02)
Java HotSpot(TM) Client VM (build 1.4.2_03-b02, mixed mode)
I got the error code: 404.
But if use a browser (Internet Explorer 5 and Mozilla 1.7) I can download the page without problems.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) compile and execute the program with java 1.5
2) compile and execute the program with java 1.4.2
3) dowload the page with a browser
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "main" java.lang.RuntimeException: java.lang.IllegalArgument
Exception: protocol = http host = null
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown So
urce)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(Unknown So
urce)
at java.net.HttpURLConnection.getResponseCode(Unknown Source)
at TestURLConnection.main(TestURLConnection.java:12)
Caused by: java.lang.IllegalArgumentException: protocol = http host = null
at sun.net.spi.DefaultProxySelector.select(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Sour
ce)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.followRedirect(Unknown So
urce)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown So
urce)
... 2 more
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.net.*;
public class TestURLConnection {
static String MYURL = "http://www.scielo.br/gmb.htm";
public static void main(String[] args) throws Exception {
URL url = new URL(MYURL);
HttpURLConnection connection =
(HttpURLConnection)url.openConnection();
connection.setFollowRedirects(true);
connection.connect();
System.out.println("code = " + connection.getResponseCode());
connection.disconnect();
}
}
---------- END SOURCE ----------
Release Regression From : 1.4.2
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Incident Review ID: 281500)
======================================================================