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 "Rodrigo Ruiz (JIRA)" <ax...@ws.apache.org> on 2005/07/21 17:42:53 UTC

[jira] Created: (AXIS-2134) ManagedMemoryDataSource does not correctly handle large attachments

ManagedMemoryDataSource does not correctly handle large attachments
-------------------------------------------------------------------

         Key: AXIS-2134
         URL: http://issues.apache.org/jira/browse/AXIS-2134
     Project: Apache Axis
        Type: Bug
  Components: Serialization/Deserialization  
    Versions: 1.2.1    
 Environment: Not platform dependent
    Reporter: Rodrigo Ruiz


When trying to send an attachment larger than 2Gbytes, I get IndexOutOfBound exceptions.

I think the problem is in the ManagedMemoryDataSource.InStream class implementation. I do not have access to the source CVS, so it's difficult to me to provide a correct patch, but I can describe it:

- The bread field should be a "long", instead of an "int"
- The available() method should return Math.min(Integer.MAX_VALUE, totalsz - bread), to ensure an integer is returned


-- 
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-2134) ManagedMemoryDataSource does not correctly handle large attachments

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

Davanum Srinivas commented on AXIS-2134:
----------------------------------------

yes, you are right. but as u can see i am paranoid :)

> ManagedMemoryDataSource does not correctly handle large attachments
> -------------------------------------------------------------------
>
>          Key: AXIS-2134
>          URL: http://issues.apache.org/jira/browse/AXIS-2134
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2.1
>  Environment: Not platform dependent
>     Reporter: Rodrigo Ruiz

>
> When trying to send an attachment larger than 2Gbytes, I get IndexOutOfBound exceptions.
> I think the problem is in the ManagedMemoryDataSource.InStream class implementation. I do not have access to the source CVS, so it's difficult to me to provide a correct patch, but I can describe it:
> - The bread field should be a "long", instead of an "int"
> - The available() method should return Math.min(Integer.MAX_VALUE, totalsz - bread), to ensure an integer is returned

-- 
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-2134) ManagedMemoryDataSource does not correctly handle large attachments

Posted by "Rodrigo Ruiz (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2134?page=comments#action_12316859 ] 

Rodrigo Ruiz commented on AXIS-2134:
------------------------------------

Great, this works for me!

Only a question: Being sure that the result from the Math.min() call is an integer value, would not it be better to use a simple type-cast?

Something like:

int ret = (int)Math.min(Integer.MAX_VALUE, totalsz - bread);

Or there is any advantage in using the Long.intValue() method?

Thanks :-)
Rodrigo Ruiz

> ManagedMemoryDataSource does not correctly handle large attachments
> -------------------------------------------------------------------
>
>          Key: AXIS-2134
>          URL: http://issues.apache.org/jira/browse/AXIS-2134
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2.1
>  Environment: Not platform dependent
>     Reporter: Rodrigo Ruiz

>
> When trying to send an attachment larger than 2Gbytes, I get IndexOutOfBound exceptions.
> I think the problem is in the ManagedMemoryDataSource.InStream class implementation. I do not have access to the source CVS, so it's difficult to me to provide a correct patch, but I can describe it:
> - The bread field should be a "long", instead of an "int"
> - The available() method should return Math.min(Integer.MAX_VALUE, totalsz - bread), to ensure an integer is returned

-- 
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-2134) ManagedMemoryDataSource does not correctly handle large attachments

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

    Resolution: Fixed

I checked in a fix (see last comment). Please verify.

thanks,
dims

> ManagedMemoryDataSource does not correctly handle large attachments
> -------------------------------------------------------------------
>
>          Key: AXIS-2134
>          URL: http://issues.apache.org/jira/browse/AXIS-2134
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2.1
>  Environment: Not platform dependent
>     Reporter: Rodrigo Ruiz

>
> When trying to send an attachment larger than 2Gbytes, I get IndexOutOfBound exceptions.
> I think the problem is in the ManagedMemoryDataSource.InStream class implementation. I do not have access to the source CVS, so it's difficult to me to provide a correct patch, but I can describe it:
> - The bread field should be a "long", instead of an "int"
> - The available() method should return Math.min(Integer.MAX_VALUE, totalsz - bread), to ensure an integer is returned

-- 
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-2134) ManagedMemoryDataSource does not correctly handle large attachments

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

Davanum Srinivas commented on AXIS-2134:
----------------------------------------

Is this patch ok? i fixed it in CVS like this. thanks, dims


Index: ManagedMemoryDataSource.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/attachments/ManagedMemoryDataSource.java,v
retrieving revision 1.36
diff -u -r1.36 ManagedMemoryDataSource.java
--- ManagedMemoryDataSource.java        1 Nov 2004 14:25:31 -0000       1.36
+++ ManagedMemoryDataSource.java        27 Jul 2005 03:16:25 -0000
@@ -487,7 +487,7 @@
     private class Instream extends java.io.InputStream {

         /** bytes read. */
-        protected int bread = 0;
+        protected long bread = 0;

         /** The real stream. */
         java.io.FileInputStream fin = null;
@@ -540,8 +540,8 @@
                 throw new java.io.IOException(
                         Messages.getMessage("streamClosed"));
             }
-            // Will return neg. value when totalsz > 2Gb
-            int ret = new Long(totalsz - bread).intValue();
+
+            int ret = new Long(Math.min(Integer.MAX_VALUE, totalsz - bread)).intValue();

             if (debugEnabled) {
                 is_log.debug("available() = " + ret + ".");




> ManagedMemoryDataSource does not correctly handle large attachments
> -------------------------------------------------------------------
>
>          Key: AXIS-2134
>          URL: http://issues.apache.org/jira/browse/AXIS-2134
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2.1
>  Environment: Not platform dependent
>     Reporter: Rodrigo Ruiz

>
> When trying to send an attachment larger than 2Gbytes, I get IndexOutOfBound exceptions.
> I think the problem is in the ManagedMemoryDataSource.InStream class implementation. I do not have access to the source CVS, so it's difficult to me to provide a correct patch, but I can describe it:
> - The bread field should be a "long", instead of an "int"
> - The available() method should return Math.min(Integer.MAX_VALUE, totalsz - bread), to ensure an integer is returned

-- 
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-2134) ManagedMemoryDataSource does not correctly handle large attachments

Posted by "Sergio Juan (JIRA)" <ax...@ws.apache.org>.
    [ http://issues.apache.org/jira/browse/AXIS-2134?page=comments#action_12316918 ] 

Sergio Juan commented on AXIS-2134:
-----------------------------------

While I'm not yet working with axis1.2, I have introduced this path in axis1.1 and I did get to transfer files of up to 3.85GB (limited due to disk space). It works just fine, the only thing needed in 1.1 is to also convert the attribute totalsz from the Instream class from int to long (in axis1.2 it was already a long).

> ManagedMemoryDataSource does not correctly handle large attachments
> -------------------------------------------------------------------
>
>          Key: AXIS-2134
>          URL: http://issues.apache.org/jira/browse/AXIS-2134
>      Project: Apache Axis
>         Type: Bug
>   Components: Serialization/Deserialization
>     Versions: 1.2.1
>  Environment: Not platform dependent
>     Reporter: Rodrigo Ruiz

>
> When trying to send an attachment larger than 2Gbytes, I get IndexOutOfBound exceptions.
> I think the problem is in the ManagedMemoryDataSource.InStream class implementation. I do not have access to the source CVS, so it's difficult to me to provide a correct patch, but I can describe it:
> - The bread field should be a "long", instead of an "int"
> - The available() method should return Math.min(Integer.MAX_VALUE, totalsz - bread), to ensure an integer is returned

-- 
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