JDK-6552954 : Java 1.6: Problem with caching results of ASP Page URL's
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6
  • Priority: P4
  • Status: Resolved
  • Resolution: Cannot Reproduce
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2007-05-02
  • Updated: 2015-02-05
  • Resolved: 2015-02-05
Description
FULL PRODUCT VERSION :
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows 2000 [Version 5.00.2195]

EXTRA RELEVANT SYSTEM CONFIGURATION :
Used both IIS 5.0 and IIS 6.0 (Windows2003) but the result is same.

A DESCRIPTION OF THE PROBLEM :
We have found a caching issue with ASP Page, when "Keep temporary files on my computer." is turned on. We have  developed a Content Management System, using Java Applets. This Applet is hosted on intranet on a Windows 2000 and Windows 2003 box. This CMS software works on a 3 Tier Architecture, where the Applets acts as a presentation layer and there is a server process running on the same box and a backed end database is there. This Applet will communicate to the Server Process through HTTP, using a intermideate file developed in ASP as well as PHP. This ASP/PHP file will create instance of an COM Object using which we talk to the server process. All operations are successfull in JRE 1.5 without any issues, but when we start using JRE 1.6 we face issues in processing the results of any HTTP requests.

We generally observed that when caching is turned on in JRE, the results for any HTTP request is fetching correctly only for the first time and on all subseqent times the result would be incorrect for the request made. Here the results are getting messedup irrespective of the HTTP Request made, though the same URL works well if i open it in a Browser. On further investigation we have found that this happens only when we send the HTTP requests to an ASP Page and no issues when we use PHP pages any number of times.

Disabling the client caching solves the problem.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1) Turn on the option "Keep temporary files on my computer.".
2) Host an Applet using a WebServer ( IIS )
3) Keep an ASP Page in the same location of Applet and return different results based on the request in Query String.
4) Inside the Applet Init method, write code to make multiple HTTP requests to the ASP Page on different occation and Capture the results.
5) Refresh the browser to see if the Applet is fetching the same results from the ASP.
6) Compare the results.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The results of the request made to an ASP Page with same query string, multiple times should be same.
ACTUAL -
The results of the HTTP Request would be incorrect when you make it twice.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
StringBuilder outputStringBuffer = new StringBuilder();
String strFullURL = "http://hostname:80/page.asp?arg1=value1&arg2=value2";
//String strFullURL = "http://hostname:80/page.asp?arg3=value3&arg4=value4";
URL objURL = new URL(strFullURL);
BufferedReader objINBR = new BufferedReader( new InputStreamReader( objURL.openStream() ) );
String strLine;
while ( (strLine = objINBR.readLine()) != null ) {
	outputStringBuffer.append(strLine);
}
objINBR.close();

System.out.println(outputStringBuffer.toString());

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
1) Open Java Control Panel
2) Go to Settings and turn off the option "Keep temporary files on my computer.".
3) Close the control pane and reload the applet in a new browser.