You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Coralia Silvana Popa (JIRA)" <ax...@ws.apache.org> on 2005/06/23 09:39:10 UTC

[jira] Created: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Dime attachements: Type_Length of the final record chunk must be zero
---------------------------------------------------------------------

         Key: AXIS-2084
         URL: http://issues.apache.org/jira/browse/AXIS-2084
     Project: Apache Axis
        Type: Bug
  Components: Serialization/Deserialization  
    Versions: 1.2, 1.2.1    
 Environment: Microsoft XP
    Reporter: Coralia Silvana Popa


Large files sent as DIME attachments are not correct serialized. Seems that the 


When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.

Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.

The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)

I suggest the following code the fix this problem:

void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
            final long maxchunk)
            throws java.io.IOException {
    	
    		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
    		
    		final int myChunkSize = dh.getChunkSize();
    		
    		byte[] buffer1 = new byte[myChunkSize]; 
    		byte[] buffer2 = new byte[myChunkSize]; 
    		
    		int bytesRead1 = 0 , bytesRead2 = 0;

    		bytesRead1 = in.read(buffer1);
    		
    		if(bytesRead1 < 0) {
                sendHeader(os, position, 0, (byte) 0);
                os.write(pad, 0, dimePadding(0));
                return;
    		}
		byte chunknext = 0;
    		do {
    			bytesRead2 = in.read(buffer2);
    			
    			if(bytesRead2 < 0) {
    				//last record...do not set the chunk bit.
    				//buffer1 contains the last chunked record!
    				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
    				break;
    			}
    			
    			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
			chunknext = CHUNK_NEXT;

    			//now that we have written out buffer1, copy buffer2 into to buffer1
    			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
    			bytesRead1 = bytesRead2;
    			
    		}while(bytesRead2 > 0);
    }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Stefano Meneghello (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12315937 ] 

Stefano Meneghello commented on AXIS-2084:
------------------------------------------

client Axis 1.2.1, Win XP, 2K (JDK 1.4.2, 1.5), .net web service.

After the patch, I obtained the following:

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
 faultSubcode: 
 faultString: In the record 819A034047D4A96C72F4E2CC92FB63BF, the number of bytes in the Data field is less than 418001, which is the value indicated in the ContentLength field.
 faultActor: http://192.168.1.13/test/test1.asmx
 faultNode: 
 faultDetail:... (I don't insert full stack trace, since I've inserted some println inside the code)

with a >2 MB pdf DIME attachment.

Before the patch, the error was "Type_Length of the final record chunk must be zero...".

Here is the output of my println's:

DimeBodyPart.send (position:2)
bytes1: 1048576, bytes2: 0
do: bytes1: 1048576, bytes2: 1048576
sendChunk: pos:2, chunk:1, length: 1048576 (1048576)
sendHeader: BEC:1
sendHeader: 1048576 (0,16,0,0)
sendChunk: padding: 0
do: bytes1: 1048576, bytes2: 418001
sendChunk: pos:2, chunk:3, length: 1048576 (1048576)
sendHeader: BEC:1
sendHeader: 1048576 (0,16,0,0)
sendChunk: padding: 0
do: bytes1: 418001, bytes2: -1
sendChunk: pos:2, chunk:2, length: 418001 (1048576)
sendHeader: BEC:2
sendHeader: 418001 (0,6,96,-47)
sendChunk: padding: 3

Hope this could help.

Stefano

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa
>     Assignee: Davanum Srinivas
>  Attachments: EchoAttachment.java
>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Coralia Silvana Popa (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12315815 ] 

Coralia Silvana Popa commented on AXIS-2084:
--------------------------------------------

I would like to add some comments about the environment the error occured: we use JBoss server (jdk 1.4.2_02) with axis 1.2 and .NET client. Sending a large file from the client to the server as attachment was OK, but not viceversa. I would also like to mention that we are testing our software since I've posted this bug using suggested patch and seems to be OK.


> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa

>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Robert Hook (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12323097 ] 

Robert Hook commented on AXIS-2084:
-----------------------------------

Poot. 1.2 doesn't seem to be readily available anywhere. However, I grabbed the current build (labelled as 1.3) and the problem goes away. We'll see what else goes wrong.

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa
>     Assignee: Davanum Srinivas
>  Attachments: DimeBodyPart.java, DimeBodyPartDiff.txt, DimeBodyPartDiff_2.txt, DimeBodyPart_2.java, EchoAttachment.java
>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Reopened: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-2084?page=all ]
     
Davanum Srinivas reopened AXIS-2084:
------------------------------------


Sigh! reopening bug as per Brian

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa
>     Assignee: Davanum Srinivas
>  Attachments: DimeBodyPart.java, DimeBodyPartDiff.txt, EchoAttachment.java
>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Brian Husted (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12315844 ] 

Brian Husted commented on AXIS-2084:
------------------------------------

Davanum,

I will hack it and get back to you soon. Thanks for your time.
Brian

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa

>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12315828 ] 

Davanum Srinivas commented on AXIS-2084:
----------------------------------------

Coralia,

so both server->client and client-server works fine (with axis server and .net client). right?

-- dims

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa

>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12315589 ] 

Davanum Srinivas commented on AXIS-2084:
----------------------------------------

looking forward to it. thanks.

-- dims

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa

>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12315838 ] 

Davanum Srinivas commented on AXIS-2084:
----------------------------------------

Brian,

could you please hack the samples/attachments to recreate the problem? that will help me fix it.

thanks,
dims

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa

>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12315884 ] 

Davanum Srinivas commented on AXIS-2084:
----------------------------------------

awesome. thanks.  

-- dims

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa
>  Attachments: EchoAttachment.java
>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-2084?page=all ]
     
Davanum Srinivas resolved AXIS-2084:
------------------------------------

    Resolution: Fixed

Please try latest CVS. I've checked in your fix. I have no clue how to test it. Please confirm that it works correctly.

-- dims

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa

>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12315764 ] 

Davanum Srinivas commented on AXIS-2084:
----------------------------------------

does client->server work with .NET? could you help replicate the problem using the sample.attachments example?

thanks,
-- dims

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa

>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Reopened: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-2084?page=all ]
     
Davanum Srinivas reopened AXIS-2084:
------------------------------------

     Assign To: Davanum Srinivas

not yet fixed.

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa
>     Assignee: Davanum Srinivas
>  Attachments: EchoAttachment.java
>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Tom Ziemer (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12316470 ] 

Tom Ziemer commented on AXIS-2084:
----------------------------------

Hi again,

thank you very much, Brian & dims for the patch you supplied. I was really astonished to see a fix for this problem in such a short time. We are now using the latest CVS version (including version 1.30 of org.apache.axis.attachments.DimeBodyPart) of Axis and have run out tests again.
- Java (Axis) client: No problem at all.
- .NET 2.0 Beta: We were able to transfer files up to a size of 256 MB. Any additional byte will cause an "System.OutOfMemoryException" on the client side, which has 2 GB of RAM. We are not exactly sure though whether this is an axis or a .Net issue.

We are currently working on another client implementation to figure out, whether this problem is caused by the server.

Anyway, since we will not be sending files larger than 100MB, the current version is perfectly fine for us. Thanks again!

Regards,
Tom


> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa
>     Assignee: Davanum Srinivas
>  Attachments: DimeBodyPart.java, DimeBodyPartDiff.txt, DimeBodyPartDiff_2.txt, DimeBodyPart_2.java, EchoAttachment.java
>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Brian Husted (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-2084?page=all ]

Brian Husted updated AXIS-2084:
-------------------------------

    Attachment: DimeBodyPartDiff.txt

A diff of the changes made vrs version from 1.2.1 FINAL
-- Brian

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa
>     Assignee: Davanum Srinivas
>  Attachments: DimeBodyPart.java, DimeBodyPartDiff.txt, EchoAttachment.java
>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Tom Ziemer (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12316338 ] 

Tom Ziemer commented on AXIS-2084:
----------------------------------

Hi, 

I was using Axis 1.2 Final on our server in cobination with a) an axis client and b) a .NET (2.0 Beta) client to send attachments. With the axis client we never encountered any problems no matter how large the files were (1-20MB). With the .NET client we only could receive attachments up to 1 MB. For files larger than that we got the exception mentioned in original bug description.

After switching to the the CVS Version of Axis (as of 07/21/05) the problem is worse: The axis client is still working as expected but the .NET client cannot receive any attachments at all (no matter how small the attachments are) and always throws this exception:
"WSE311: The Type_T of non_chunked record must not be 0 (Type_T=Unchanged)." [Source: Microsoft.Web.Services2]
We are using version 1.29 of org.apache.axis.attachments.DimeBodyPart

Tom



> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa
>     Assignee: Davanum Srinivas
>  Attachments: DimeBodyPart.java, DimeBodyPartDiff.txt, EchoAttachment.java
>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Brian Husted (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12315586 ] 

Brian Husted commented on AXIS-2084:
------------------------------------

We will be testing this solution with our .NET partners shortly (next two weeks) -- www.grants.gov/WebServices

I will respond with our results when they become available.

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa

>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12315761 ] 

Davanum Srinivas commented on AXIS-2084:
----------------------------------------

was it working before the patch? 

-- dims

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa

>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Coralia Silvana Popa (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12314299 ] 

Coralia Silvana Popa commented on AXIS-2084:
--------------------------------------------

Sorry I've posted this issue by mistake when its description was not ready. The correct description should be the following:


Large files sent as DIME attachments are not correct serialized. Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck. 

The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk) 

I suggest the following code the fix this problem: 

void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)   throws java.io.IOException { 
     
        BufferedInputStream in = new BufferedInputStream(dh.getInputStream()); 
     
         final int myChunkSize = dh.getChunkSize(); 
     
        byte[] buffer1 = new byte[myChunkSize]; 
        byte[] buffer2 = new byte[myChunkSize]; 
     
        int bytesRead1 = 0 , bytesRead2 = 0; 

        bytesRead1 = in.read(buffer1); 
     
        if(bytesRead1 < 0) { 
                sendHeader(os, position, 0, (byte) 0); 
                os.write(pad, 0, dimePadding(0)); 
                return; 
       } 
       byte chunknext = 0; 
       do { 
            bytesRead2 = in.read(buffer2); 
     
            if(bytesRead2 < 0) { 
                   //last record...do not set the chunk bit. 
                    //buffer1 contains the last chunked record! 
                    sendChunk(os, position, buffer1, 0, bytesRead1, chunknext); 
                    break; 
           } 
     
          sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) ); 
          chunknext = CHUNK_NEXT; 

         //now that we have written out buffer1, copy buffer2 into to buffer1 
        System.arraycopy(buffer2,0,buffer1,0,myChunkSize); 
        bytesRead1 = bytesRead2; 
     
     }while(bytesRead2 > 0); 
    }


> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa

>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Brian Husted (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12315762 ] 

Brian Husted commented on AXIS-2084:
------------------------------------

No, I tried rolling back your patch and still didn't work.  In all cases, sending from Server to Client works fine but client to server fails.  Very strange to me since it appears to be using the same code.   I also noticed that client to server works fine when only a single chunk is sent.  In other words, if the chunk size in the DynamicContentDataHandler is smaller than the attachment size then it works.  Let me know if you need more information or need me to run additional tests.

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa

>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12316420 ] 

Davanum Srinivas commented on AXIS-2084:
----------------------------------------

Brian,
Applied. 

Tom,
Could you please verify latest CVS?

thanks,
dims

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa
>     Assignee: Davanum Srinivas
>  Attachments: DimeBodyPart.java, DimeBodyPartDiff.txt, DimeBodyPartDiff_2.txt, DimeBodyPart_2.java, EchoAttachment.java
>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Brian Husted (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-2084?page=all ]

Brian Husted updated AXIS-2084:
-------------------------------

    Attachment: DimeBodyPartDiff_2.txt
                DimeBodyPart_2.java

dims/Tom,

I ran into this problem as well.  I have attached a patch that resolves this problem.  Before the recently commited patch all of the header fields were being sent on every record, to include the TYPE_T which per the DIME spec is not correct.  The problem you are currently facing is related to the TYPE_T, TYPE_LENGTH, and TYPE not being sent on the MB DIME record (the first record)  

The attached patch has enabled our .NET partners to pull attachments from our Axis server at sizes ranging from 5 - 100MB (using 10MB chunks).  Sizes greater than 100MB are most likely possible we just haven't tested.   However, we still have the same problem when trying to submit attachments from the Axis client to the Axis Server.  Therefore, I was waiting to release this patch until I could resolve the prior issue that I posted.   Given Tom's note, I have went ahead an included the new patch DimeBodyPartDiff_2.txt (diff from cvs).  In addition, I am still working to correct the Axis client to Server issue; so expect another patch in the next two weeks.

--
Brian

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa
>     Assignee: Davanum Srinivas
>  Attachments: DimeBodyPart.java, DimeBodyPartDiff.txt, DimeBodyPartDiff_2.txt, DimeBodyPart_2.java, EchoAttachment.java
>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Brian Husted (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12317340 ] 

Brian Husted commented on AXIS-2084:
------------------------------------

Done.

http://issues.apache.org/jira/browse/AXIS-2158

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa
>     Assignee: Davanum Srinivas
>  Attachments: DimeBodyPart.java, DimeBodyPartDiff.txt, DimeBodyPartDiff_2.txt, DimeBodyPart_2.java, EchoAttachment.java
>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Brian Husted (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12315836 ] 

Brian Husted commented on AXIS-2084:
------------------------------------

I ran another test with the same result. 
Axis Client (jdk 1.4.2_05) to Axis Server on (Tomcat 5 jdk 1.4.2_05)  
large file requiring more than one DIME packet When running the server on Tomcat

 java.io.IOException: End of physical stream detected when 11 more bytes expected.
	at org.apache.axis.attachments.DimeDelimitedInputStream._read(DimeDelimitedInputStream.java:308)
	at org.apache.axis.attachments.DimeDelimitedInputStream.read(DimeDelimitedInputStream.java:236)
	at org.apache.axis.attachments.DimeDelimitedInputStream.read(DimeDelimitedInputStream.java:479)
	at org.apache.axis.attachments.ManagedMemoryDataSource.<init>(ManagedMemoryDataSource.java:174)
	at org.apache.axis.attachments.MultiPartDimeInputStream.readTillFound(MultiPartDimeInputStream.java:203)
	at org.apache.axis.attachments.MultiPartDimeInputStream.readAll(MultiPartDimeInputStream.java:140)
	at org.apache.axis.attachments.MultiPartDimeInputStream.getAttachments(MultiPartDimeInputStream.java:148)
	at org.apache.axis.attachments.AttachmentsImpl.mergeinAttachments(AttachmentsImpl.java:190)
	at org.apache.axis.attachments.AttachmentsImpl.getAttachmentCount(AttachmentsImpl.java:554)


> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa

>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Brian Husted (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-2084?page=all ]

Brian Husted updated AXIS-2084:
-------------------------------

    Attachment: DimeBodyPart.java

Dims,

After exhaustive debugging, I have attached a patch to fix this issue.  The problem was related to the TYPE and ID header lengths/data being sent on EVERY DIME chunk.  Per the DIME specification section 2.1.3 the ID_LENGTH and TYPE_LENGTH and associated data shall only be sent in the FIRST chunk (please see http://www.gotdotnet.com/team/xml_wsspecs/dime/draft-nielsen-dime-01.txt).  It appears from the code comments an attempt was made to satisfy this requirement but failed to execute properly leading to the errors we have been seeing.  The patch was tested both with attachments that were larger in size than the chunk size and greater in size.  In addition, testing was performed attaching both single and multiple attachments in the SOAP message.

The changes that were made included adding two new static variables, modified sendHeader and send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
            final long maxchunk) methods.  The send method was modified to pass in a value of CHUNK for the first DIME chunk and CHUNK_NEXT for subsequent chunks.  Then in the sendHeader method, the logic for detecting the first chunk was modified to check if the value is CHUNK then send the ID and TYPE.  Subsequent chunks are then sent without the ID and TYPE.

In addition, the code sending the last chunk was modified to detect if the last chunk was also the first chunk.  This arises when the chunk size is larger than the attachment size.  In this case, where only one chunk is being sent I pass in ONLY_CHUNK flag.  The sendHeader then handles this by NOT setting the CF flag and sending the ID and TYPE.

The code still needs to be tested with a .NET server.  Our WS partners will be testing with this code in the next two weeks but it would be great if someone could test ahead of that.

--  Brian 


> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa
>     Assignee: Davanum Srinivas
>  Attachments: DimeBodyPart.java, DimeBodyPartDiff.txt, EchoAttachment.java
>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Brian Husted (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12315774 ] 

Brian Husted commented on AXIS-2084:
------------------------------------

Given my experience level with .NET, I don't have the bandwidth to invest in testing that right now.  Any other volunteers?

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa

>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Robert Hook (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12323096 ] 

Robert Hook commented on AXIS-2084:
-----------------------------------

I think this needs to be re-opened. I've stumbled into this problem with the 1.2.1 release, and just started to explore my options. First thing I did was revert to 1.2RC3 - and the problem went away. So this is something that was introduced between 1.2RC3 and 1.2.1.

I will test 1.2 and see what the result is and post a follow up comment here. 

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa
>     Assignee: Davanum Srinivas
>  Attachments: DimeBodyPart.java, DimeBodyPartDiff.txt, DimeBodyPartDiff_2.txt, DimeBodyPart_2.java, EchoAttachment.java
>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Updated: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Brian Husted (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-2084?page=all ]

Brian Husted updated AXIS-2084:
-------------------------------

    Attachment: EchoAttachment.java

Davanum, 

As requested, I have hacked the samples.attachments.EchoAttachments.  I changed the main method to use DIME only and changed the echo method to use the DynamicContentDataHandler with a chunk size of 1k.   To recreate, you will need to invoke the main method passing in a full file path to a local file that is larger than 1k.  
Below is the stack trace I am getting.  Let me know if there is anything else I can do.  I will try and debug this as well. 

I tested with Axis 1.2.1client and server running jdk1.4.2_05 and Tomcat 5.0 for server.

Caused by: java.io.IOException: End of physical stream detected when more DIME chunks expected.
        at org.apache.axis.attachments.DimeDelimitedInputStream._read(DimeDelimitedInputStream.java:268)
        at org.apache.axis.attachments.DimeDelimitedInputStream.read(DimeDelimitedInputStream.java:201)
        at org.apache.axis.attachments.DimeDelimitedInputStream.read(DimeDelimitedInputStream.java:445)
        at org.apache.axis.attachments.ManagedMemoryDataSource.<init>(ManagedMemoryDataSource.java:146)
        at org.apache.axis.attachments.MultiPartDimeInputStream.readTillFound(MultiPartDimeInputStream.java:163)
        ... 46 more
        at org.apache.axis.encoding.DeserializationContext.getObjectByRef(DeserializationContext.java:619)
        at org.apache.axis.encoding.ser.JAFDataHandlerDeserializer.startElement(JAFDataHandlerDeserializer.java:70)
        at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1048)
        at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
        at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
        at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
        at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
        at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:148)
        at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
        ... 33 more

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa
>  Attachments: EchoAttachment.java
>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Brian Husted (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12316019 ] 

Brian Husted commented on AXIS-2084:
------------------------------------

dims,

Even with the latest patch there is still an issue with the code.  For strange reason, sending more than 8 DIME chunks results in the same error.  I am still looking into this error.  I'll get back when I have a resolution.

--
Brian

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa
>     Assignee: Davanum Srinivas
>  Attachments: DimeBodyPart.java, DimeBodyPartDiff.txt, EchoAttachment.java
>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Commented: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Brian Husted (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2084?page=comments#action_12315758 ] 

Brian Husted commented on AXIS-2084:
------------------------------------

Unfortunutely, I have run into some difficulties regarding streaming attachments using DIME with the Axis patch.  It works fine when submitting attachments from the Axis server to the Axis client.  However, when I attempt to submit an attachment from the Axis client to the Axis server running the Web Services it has problems.   I am using Axis version 1.2.1, running the client in Java JDK 1.4.2_05 and server running Weblogic 7 on JDK 1.3.1. 

Below is the server side stack trace:

java.io.IOException: End of physical stream detected when 11 more bytes expected.
        at org.apache.axis.attachments.DimeDelimitedInputStream._read(DimeDelimitedInputStream.java:273)
        at org.apache.axis.attachments.DimeDelimitedInputStream.read(DimeDelimitedInputStream.java:201)
        at org.apache.axis.attachments.DimeDelimitedInputStream.read(DimeDelimitedInputStream.java:445)
        at org.apache.axis.attachments.ManagedMemoryDataSource.<init>(ManagedMemoryDataSource.java:146)
        at org.apache.axis.attachments.MultiPartDimeInputStream.readTillFound(MultiPartDimeInputStream.java:163)
        at org.apache.axis.attachments.MultiPartDimeInputStream.readAll(MultiPartDimeInputStream.java:100)
        at org.apache.axis.attachments.MultiPartDimeInputStream.getAttachments(MultiPartDimeInputStream.java:108)
        at org.apache.axis.attachments.AttachmentsImpl.mergeinAttachments(AttachmentsImpl.java:156)
        at org.apache.axis.attachments.AttachmentsImpl.getAttachmentCount(AttachmentsImpl.java:515)


> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa

>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-2084?page=all ]
     
Davanum Srinivas resolved AXIS-2084:
------------------------------------

    Resolution: Fixed

Brian,

checked in your diff. next time, please submit a diff against latest CVS.

thanks,
dims

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa
>     Assignee: Davanum Srinivas
>  Attachments: DimeBodyPart.java, DimeBodyPartDiff.txt, EchoAttachment.java
>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


[jira] Resolved: (AXIS-2084) Dime attachements: Type_Length of the final record chunk must be zero

Posted by "Davanum Srinivas (JIRA)" <ax...@ws.apache.org>.
     [ http://issues.apache.org/jira/browse/AXIS-2084?page=all ]
     
Davanum Srinivas resolved AXIS-2084:
------------------------------------

    Resolution: Fixed

Brian,

We've cluttered this bug enough...For the "sending more than 8 DIME chunks results in the same error" problem, please start a new JIRA issue and upload your patch when you have it.

thanks,
dims

> Dime attachements: Type_Length of the final record chunk must be zero
> ---------------------------------------------------------------------
>
>          Key: AXIS-2084
>          URL: http://issues.apache.org/jira/browse/AXIS-2084
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2, 1.2.1
>  Environment: Microsoft XP
>     Reporter: Coralia Silvana Popa
>     Assignee: Davanum Srinivas
>  Attachments: DimeBodyPart.java, DimeBodyPartDiff.txt, DimeBodyPartDiff_2.txt, DimeBodyPart_2.java, EchoAttachment.java
>
> Large files sent as DIME attachments are not correct serialized. Seems that the 
> When reading a series of chunked records, the parser assumes that the first record without the CF flag is the final record in the chunk; in this case, it's the last record in my sample. The record type is specified only in the first record chunk, and all remaining chunks must have the TYPE_T field and all remaining header fields (except for the DATA_LENGTH field) set to zero.
> Seems that Type_Length (and maybe other header fields) is not set to 0 for the last chunk. The code work correct when there is only one chunck.
> The problem is in class: org.apache.axis.attachments.DimeBodyPart, in method void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh, final long maxchunk)
> I suggest the following code the fix this problem:
> void send(java.io.OutputStream os, byte position, DynamicContentDataHandler dh,
>             final long maxchunk)
>             throws java.io.IOException {
>     	
>     		BufferedInputStream in = new BufferedInputStream(dh.getInputStream());
>     		
>     		final int myChunkSize = dh.getChunkSize();
>     		
>     		byte[] buffer1 = new byte[myChunkSize]; 
>     		byte[] buffer2 = new byte[myChunkSize]; 
>     		
>     		int bytesRead1 = 0 , bytesRead2 = 0;
>     		bytesRead1 = in.read(buffer1);
>     		
>     		if(bytesRead1 < 0) {
>                 sendHeader(os, position, 0, (byte) 0);
>                 os.write(pad, 0, dimePadding(0));
>                 return;
>     		}
> 		byte chunknext = 0;
>     		do {
>     			bytesRead2 = in.read(buffer2);
>     			
>     			if(bytesRead2 < 0) {
>     				//last record...do not set the chunk bit.
>     				//buffer1 contains the last chunked record!
>     				sendChunk(os, position, buffer1, 0, bytesRead1, chunknext);
>     				break;
>     			}
>     			
>     			sendChunk(os, position, buffer1, 0, bytesRead1,(byte) (CHUNK | chunknext) );
> 			chunknext = CHUNK_NEXT;
>     			//now that we have written out buffer1, copy buffer2 into to buffer1
>     			System.arraycopy(buffer2,0,buffer1,0,myChunkSize);
>     			bytesRead1 = bytesRead2;
>     			
>     		}while(bytesRead2 > 0);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira