JDK-6957375 : java/net/ResponseCache getResponseCode and ResponseCacheTest fail after rebranding
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2010-06-01
  • Updated: 2011-05-18
  • Resolved: 2011-05-18
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 Other
7 b100Fixed OpenJDK6Fixed
Description
This test seems to be failing on all platforms. Here's an example from JPRT:

--------------------------------------------------
TEST: java/net/ResponseCache/getResponseCode.java
JDK under test: (/tmp/jprt/T1/T/082813.ab23780/testproduct/linux_i586_2.6-product)
java version "1.7.0-internal"
Java(TM) SE Runtime Environment (build 1.7.0-internal-jprtadm_2010_06_01_03_58-b00)
Java HotSpot(TM) Client VM (build 19.0-b01, mixed mode, sharing)

ACTION: build -- Passed. Build successful
REASON: Named class compiled on demand
TIME:   0.021 seconds
messages:
command: build getResponseCode
reason: Named class compiled on demand
elapsed time (seconds): 0.021

ACTION: compile -- Passed. Compilation successful
REASON: .class file out of date or does not exist
TIME:   0.021 seconds
messages:
command: compile /tmp/jprt/T1/T/082813.ab23780/source/jdk/test/java/net/ResponseCache/getResponseCode.java
reason: .class file out of date or does not exist
elapsed time (seconds): 0.021
direct:
Note: /tmp/jprt/T1/T/082813.ab23780/source/jdk/test/java/net/ResponseCache/getResponseCode.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.

ACTION: main -- Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: java.lang.RuntimeException: invalid stream header: ACED0573
REASON: Assumed action based on file name: run main getResponseCode 
TIME:   0.006 seconds
messages:
command: main getResponseCode
reason: Assumed action based on file name: run main getResponseCode 
elapsed time (seconds): 0.006
STDOUT:
STDERR:
java.lang.RuntimeException: java.lang.RuntimeException: invalid stream header: ACED0573
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1106)
	at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(HttpURLConnection.java:2491)
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:468)
	at getResponseCode.<init>(getResponseCode.java:46)
	at getResponseCode.main(getResponseCode.java:57)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:613)
	at com.sun.javatest.regtest.MainAction$SameVMRunnable.run(MainAction.java:680)
	at java.lang.Thread.run(Thread.java:717)
Caused by: java.lang.RuntimeException: invalid stream header: ACED0573
	at getResponseCode$MyResponse.<init>(getResponseCode.java:82)
	at getResponseCode$MyResponseCache.get(getResponseCode.java:67)
	at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:754)
	at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:727)
	at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1164)
	at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:459)
	... 8 more

JavaTest Message: Test threw exception: java.lang.RuntimeException
JavaTest Message: shutting down test


TEST RESULT: Failed. Execution failed: `main' threw exception: java.lang.RuntimeException: java.lang.RuntimeException: invalid stream header: ACED0573
java/net/ResponseCache/ResponseCacheTest.java also fails with:

>: java ResponseCacheTest     
request headers: {}
responsecode is :-1
responsecode2 is :200
headers1{}
headers2={null=[HTTP/1.1 200 OK], Content-Length=[5225], Content-Type=[text/html; charset=iso-8859-1], Connection=[close]}
Exception in thread "main" java.lang.RuntimeException: test failed
	at ResponseCacheTest.<init>(ResponseCacheTest.java:149)
	at ResponseCacheTest.main(ResponseCacheTest.java:157)

Comments
EVALUATION Since more than one test relies on this file, and compares it to the contents of another of these hybrid files. Simplest/Safest to revert file1.cache to its state before rebranding changes.
04-06-2010

EVALUATION This test reads a serialized Map of headers from a binary file, file1.cache. This file was inadvertently modified by the rebranding changes CR 6943119: "Rebrand source copyright notices". The cache file no longer represents a valid serialized object. Changeset for CR 6943119: "Rebrand source copyright notices" http://hg.openjdk.java.net/jdk7/tl/jdk/rev/00cd9dc3c2b5 The solution is to either revert file1.cache to its original form, or simply move its contents into the test.
01-06-2010