United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6595324 Three tests in JCK-runtime-6a alt.bundle fail only with agent started in java plugin
JDK-6595324 : Three tests in JCK-runtime-6a alt.bundle fail only with agent started in java plugin

Details
Type:
Bug
Submit Date:
2007-08-21
Status:
Closed
Updated Date:
2012-03-22
Project Name:
JDK
Resolved Date:
2011-05-18
Component:
core-libs
OS:
generic
Sub-Component:
java.net
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
6.0_01
Fixed Versions:

Related Reports
Backport:
Backport:
Relates:

Sub Tasks

Description
JCK: 6a runtime b14 with alt. bundle b01
JDK: 6u3 b02

Three tests:
api/javax_xml/ws/ee/w2j/rpc/literal/headertest/SoapHeaderFaultTest.html#SoapHeaderFaultTest
api/javax_xml/ws/handler/LogicalHandler/ServerLogicalInboundHandleFaultFalseTest.html#ServerLogicalInboundHandleFaultFalseTest
api/javax_xml/ws/handler/soap/SOAPHandler/ServerSOAPInboundHandleFaultFalseTest.html#ServerSOAPInboundHandleFaultFalseTest

fail in the configuration with active agent started in java plugin only.

                                    

Comments
EVALUATION

This bug appears because web service client cannot read more than 4KB of data through plugin's HttpURLConnection. 
Please, unzip an attached test, build test code with build.sh and run server with run-server.sh.
Test client class client.Client simulates web service client activity. When it is run as a standalone application the output is:
====================================================
-- [ 500 (should be 500) Internal Server Error ] --
HTTP/1.1 500 Internal Server Error
Transfer-encoding:chunked
Content-type:text/xml; charset=utf-8
<?xml version="1.0" ?><S:Envelope ...
Response length: 4140
======================================================
When run in applet:
======================================================
HTTP/1.1 500 Internal Server Error
Transfer-encoding:chunked
Content-type:text/xml; charset=utf-8
<?xml version="1.0" ?><S:Envelope ...
Response length: 4096
=======================================================
Note the difference in the length of response.

Also, note that there is no exception reported to client 
in this case.

Version information:
Mozilla version: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.8.1.1) Gecko/20070226 Firefox/2.0.0.1
Plugin versions: 1.6.0, 1.6.03-ea
                                     
2007-08-22
SUGGESTED FIX

------- HttpURLConnection.java -------
2581a2582
>               boolean isChunked = false;
2584a2586
>                   isChunked = true;
2596c2598
<                               if (cl < 0) {
---
>                               if (isChunked) {
2623c2625
<                   }  else if (count == expected || (cl < 0 && len <0)) {
---
>                   }  else if ((count == expected && !(isChunked)) || (isChunked && len <0)) {
                                     
2007-08-30
EVALUATION

This bug can be reproduce independently of Java Plugin.

This is a bug in the handling of errorStream buffering when the response body is chunked and the its size is greater than the errorStream.bufferSize, default 4K.

As we do not know the content length of a chunked response body we simply set the expected amount to the size of the errorStream buffer, default 4K. That way we will read until EOF or errorStream.bufferSize. The problem only arises when the response body is greater than the 
errorStream.bufferSize. The logic that determines if all the response body has been read incorrectly determines that it has. This is because we have set the expected amount be the same as the  errorStream.bufferSize. 

The only way to determine if a chunked response body has been complete read it to reach EOF.
                                     
2007-08-30



Hardware and Software, Engineered to Work Together