JDK-4655826 : Can't use HttpURLConnection.getResponseCode to obtain response code >=400
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 1.3.0_05
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: solaris_8
  • CPU: generic
  • Submitted: 2002-03-21
  • Updated: 2002-03-21
  • Resolved: 2002-03-21
Related Reports
Duplicate :  
Description
HttpURLConnection.getResponseCode throws FileNotFoundException if the 
HTTP response code is >=400.

When calling HttpURLConnection.getResponseCode to obtain the HTTP
response code, this method apparently invokes 
HttpURLConnection.getInputStream. However, getInputStream will throw
an FileNotFoundException if the HTTP response code is >=400 and the
URL does not end with either ".html", ".htm", "/" or ".txt".

This problem prohibits us from using HttpURLConnection to connect to
non-HTML based URL.

Comments
EVALUATION Already fixed in 1.4.0 - see 4160499. Also fix has been back-ported into 1.3.1_04 update release. ###@###.### 2002-03-21
21-03-2002