You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Evgenii Philippov (JIRA)" <ji...@apache.org> on 2006/07/14 11:32:30 UTC

[jira] Created: (IO-84) Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams

Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams
---------------------------------------------------------------------------------------------

         Key: IO-84
         URL: http://issues.apache.org/jira/browse/IO-84
     Project: Commons IO
        Type: Bug

    Versions: 1.2, Nightly Builds, 1.3    
 Environment: All
    Reporter: Evgenii Philippov


java int.MAX_VALUE is 2 GB. Classes that handle streams larger than 2 GB will behave incorrectly.

For example, see 
http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java?view=markup
Method: int copy(InputStream input, OutputStream output).

The correct method would be: long copy(InputStream input, OutputStream output).

This issue may affect many classes and routines.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (IO-84) Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-84?page=comments#action_12440661 ] 
            
Stephen Colebourne commented on IO-84:
--------------------------------------

This issue only affects 
IOUtils.copy(InputStream,OutputStream)
IOUtils.copy(Reader, Writer)

Comment added to these methods

> Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams
> ---------------------------------------------------------------------------------------------
>
>                 Key: IO-84
>                 URL: http://issues.apache.org/jira/browse/IO-84
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 1.2
>         Environment: All
>            Reporter: Evgenii Philippov
>             Fix For: 1.3
>
>
> java int.MAX_VALUE is 2 GB. Classes that handle streams larger than 2 GB will behave incorrectly.
> For example, see 
> http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java?view=markup
> Method: int copy(InputStream input, OutputStream output).
> The correct method would be: long copy(InputStream input, OutputStream output).
> This issue may affect many classes and routines.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Resolved: (IO-84) Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/IO-84?page=all ]

Niall Pemberton resolved IO-84.
-------------------------------

    Resolution: Fixed

Closing as fixed.

> Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams
> ---------------------------------------------------------------------------------------------
>
>                 Key: IO-84
>                 URL: http://issues.apache.org/jira/browse/IO-84
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 1.2
>         Environment: All
>            Reporter: Evgenii Philippov
>             Fix For: 1.3
>
>         Attachments: io-84-files-larger-than-2gb.patch
>
>
> java int.MAX_VALUE is 2 GB. Classes that handle streams larger than 2 GB will behave incorrectly.
> For example, see 
> http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java?view=markup
> Method: int copy(InputStream input, OutputStream output).
> The correct method would be: long copy(InputStream input, OutputStream output).
> This issue may affect many classes and routines.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (IO-84) Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-84?page=comments#action_12441663 ] 
            
Niall Pemberton commented on IO-84:
-----------------------------------

Committed those changes to IOUtils to add copyLarge() methods and throw and ArithmeticException in the original copy() methods.

I have modifications to the IOUtils unit tests (IOUtilsCopyTestCase) to test the changes, but they use the MockInputStream and MockReader implementations from IO-94 - so I'll hold off committing those until the decison on what to do with those implementations is made.

> Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams
> ---------------------------------------------------------------------------------------------
>
>                 Key: IO-84
>                 URL: http://issues.apache.org/jira/browse/IO-84
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 1.2
>         Environment: All
>            Reporter: Evgenii Philippov
>             Fix For: 1.3
>
>         Attachments: io-84-files-larger-than-2gb.patch
>
>
> java int.MAX_VALUE is 2 GB. Classes that handle streams larger than 2 GB will behave incorrectly.
> For example, see 
> http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java?view=markup
> Method: int copy(InputStream input, OutputStream output).
> The correct method would be: long copy(InputStream input, OutputStream output).
> This issue may affect many classes and routines.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (IO-84) Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-84?page=comments#action_12455191 ] 
            
Stephen Colebourne commented on IO-84:
--------------------------------------

I've changed IOUtils.copy to return -1 rather than an exception. The problem was that copy() was used from lots of other places, which didn't care about the number of bytes copied. As such, I reason that the most common use case for copy() is to not care about the number of bytes copied.

By returning -1 from the int copy methods, the bug is dealt with (the result is now consistent and javadocced). The copyLarge() method exists for those that want accurate counts. While copy() itself will never fail to copy, as in previous versions - the most backwards compatible option.


> Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams
> ---------------------------------------------------------------------------------------------
>
>                 Key: IO-84
>                 URL: http://issues.apache.org/jira/browse/IO-84
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 1.2
>         Environment: All
>            Reporter: Evgenii Philippov
>             Fix For: 1.3
>
>         Attachments: io-84-files-larger-than-2gb.patch
>
>
> java int.MAX_VALUE is 2 GB. Classes that handle streams larger than 2 GB will behave incorrectly.
> For example, see 
> http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java?view=markup
> Method: int copy(InputStream input, OutputStream output).
> The correct method would be: long copy(InputStream input, OutputStream output).
> This issue may affect many classes and routines.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (IO-84) Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams

Posted by "Evgenii Philippov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-84?page=comments#action_12421884 ] 
            
Evgenii Philippov commented on IO-84:
-------------------------------------

One possible solution would be to add methods like "long copyLongStream()" and mark "int copy()" as deprecated.

Does not sound attractive though, but the only other solution is to break compatibility.

> Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams
> ---------------------------------------------------------------------------------------------
>
>                 Key: IO-84
>                 URL: http://issues.apache.org/jira/browse/IO-84
>             Project: Commons IO
>          Issue Type: Bug
>    Affects Versions: 1.2
>         Environment: All
>            Reporter: Evgenii Philippov
>             Fix For: 1.3
>
>
> java int.MAX_VALUE is 2 GB. Classes that handle streams larger than 2 GB will behave incorrectly.
> For example, see 
> http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java?view=markup
> Method: int copy(InputStream input, OutputStream output).
> The correct method would be: long copy(InputStream input, OutputStream output).
> This issue may affect many classes and routines.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (IO-84) Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/IO-84?page=all ]

Niall Pemberton updated IO-84:
------------------------------

    Attachment: io-84-files-larger-than-2gb.patch

Attaching patches for IOUtils, CountingInputStream and CountingOutputStream to return Integer.MAX_VALUE if the size is larger than 2GB (plus test cases)

> Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams
> ---------------------------------------------------------------------------------------------
>
>                 Key: IO-84
>                 URL: http://issues.apache.org/jira/browse/IO-84
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 1.2
>         Environment: All
>            Reporter: Evgenii Philippov
>             Fix For: 1.3
>
>         Attachments: io-84-files-larger-than-2gb.patch
>
>
> java int.MAX_VALUE is 2 GB. Classes that handle streams larger than 2 GB will behave incorrectly.
> For example, see 
> http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java?view=markup
> Method: int copy(InputStream input, OutputStream output).
> The correct method would be: long copy(InputStream input, OutputStream output).
> This issue may affect many classes and routines.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (IO-84) Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-84?page=comments#action_12440740 ] 
            
Niall Pemberton commented on IO-84:
-----------------------------------

CountingInputStream and CountingOutputStream also suffer from the same issue - however they were recently deprecated, although I'm not sure why.

> Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams
> ---------------------------------------------------------------------------------------------
>
>                 Key: IO-84
>                 URL: http://issues.apache.org/jira/browse/IO-84
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 1.2
>         Environment: All
>            Reporter: Evgenii Philippov
>             Fix For: 1.3
>
>
> java int.MAX_VALUE is 2 GB. Classes that handle streams larger than 2 GB will behave incorrectly.
> For example, see 
> http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java?view=markup
> Method: int copy(InputStream input, OutputStream output).
> The correct method would be: long copy(InputStream input, OutputStream output).
> This issue may affect many classes and routines.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (IO-84) Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-84?page=comments#action_12441575 ] 
            
Stephen Colebourne commented on IO-84:
--------------------------------------

I'm happy with these IOUtils additions, so feel free to commit if you get a chance.

> Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams
> ---------------------------------------------------------------------------------------------
>
>                 Key: IO-84
>                 URL: http://issues.apache.org/jira/browse/IO-84
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 1.2
>         Environment: All
>            Reporter: Evgenii Philippov
>             Fix For: 1.3
>
>         Attachments: io-84-files-larger-than-2gb.patch
>
>
> java int.MAX_VALUE is 2 GB. Classes that handle streams larger than 2 GB will behave incorrectly.
> For example, see 
> http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java?view=markup
> Method: int copy(InputStream input, OutputStream output).
> The correct method would be: long copy(InputStream input, OutputStream output).
> This issue may affect many classes and routines.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (IO-84) Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-84?page=comments#action_12440741 ] 
            
Niall Pemberton commented on IO-84:
-----------------------------------

One other thought - maybe the affected methods in IOUtils should do something consistent in the event of the files being larger the 2GB:

 - return a negative value, e.g. -1
 - return the Integer  maximum value

> Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams
> ---------------------------------------------------------------------------------------------
>
>                 Key: IO-84
>                 URL: http://issues.apache.org/jira/browse/IO-84
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 1.2
>         Environment: All
>            Reporter: Evgenii Philippov
>             Fix For: 1.3
>
>
> java int.MAX_VALUE is 2 GB. Classes that handle streams larger than 2 GB will behave incorrectly.
> For example, see 
> http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java?view=markup
> Method: int copy(InputStream input, OutputStream output).
> The correct method would be: long copy(InputStream input, OutputStream output).
> This issue may affect many classes and routines.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (IO-84) Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/IO-84?page=all ]

Stephen Colebourne updated IO-84:
---------------------------------

        Fix Version/s: 1.3
    Affects Version/s:     (was: Nightly Builds)
                           (was: 1.3)

The method signatures cannot be changed due to backwards compatability, however we should check to see what the impact of this is

> Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams
> ---------------------------------------------------------------------------------------------
>
>                 Key: IO-84
>                 URL: http://issues.apache.org/jira/browse/IO-84
>             Project: Commons IO
>          Issue Type: Bug
>    Affects Versions: 1.2
>         Environment: All
>            Reporter: Evgenii Philippov
>             Fix For: 1.3
>
>
> java int.MAX_VALUE is 2 GB. Classes that handle streams larger than 2 GB will behave incorrectly.
> For example, see 
> http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java?view=markup
> Method: int copy(InputStream input, OutputStream output).
> The correct method would be: long copy(InputStream input, OutputStream output).
> This issue may affect many classes and routines.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (IO-84) Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-84?page=comments#action_12440783 ] 
            
Niall Pemberton commented on IO-84:
-----------------------------------

I've fixed this issue for CountingInputStream and CountingOutputStream - original getCount() and resetCount() methods have been deprecated and new getByteCount() and resetByteCount() methods added.

> Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams
> ---------------------------------------------------------------------------------------------
>
>                 Key: IO-84
>                 URL: http://issues.apache.org/jira/browse/IO-84
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 1.2
>         Environment: All
>            Reporter: Evgenii Philippov
>             Fix For: 1.3
>
>
> java int.MAX_VALUE is 2 GB. Classes that handle streams larger than 2 GB will behave incorrectly.
> For example, see 
> http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java?view=markup
> Method: int copy(InputStream input, OutputStream output).
> The correct method would be: long copy(InputStream input, OutputStream output).
> This issue may affect many classes and routines.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (IO-84) Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-84?page=comments#action_12441471 ] 
            
Stephen Colebourne commented on IO-84:
--------------------------------------

I've changed these from deprecated to throw an exception instead (although I'm open to -1/MIN_VALUE/MAX_VALUE too)

The reason is that most users will probably only care about smaller files, and inconveniencing the many for the few is too harsh a response to this problem.The javadoc together with an exception would seem to be a safe way to deal with the problem.

This call is now awaiting feedback or closure.


> Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams
> ---------------------------------------------------------------------------------------------
>
>                 Key: IO-84
>                 URL: http://issues.apache.org/jira/browse/IO-84
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 1.2
>         Environment: All
>            Reporter: Evgenii Philippov
>             Fix For: 1.3
>
>         Attachments: io-84-files-larger-than-2gb.patch
>
>
> java int.MAX_VALUE is 2 GB. Classes that handle streams larger than 2 GB will behave incorrectly.
> For example, see 
> http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java?view=markup
> Method: int copy(InputStream input, OutputStream output).
> The correct method would be: long copy(InputStream input, OutputStream output).
> This issue may affect many classes and routines.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (IO-84) Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams

Posted by "Niall Pemberton (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/IO-84?page=comments#action_12441512 ] 
            
Niall Pemberton commented on IO-84:
-----------------------------------

I'm happy with throwing the exception.

How about the same behaviour in IOUtils - add 2 new copyLarge() methods and throw an ArithmeticException in the original copy() methods if they exceed 2GB?

I tried to attach a patch for this but got an error  saying:

"Exception trying to establish attachment directory. Check that the application server and JIRA have permissions to write to it: com.atlassian.jira.web.util.AttachmentException: Cannot write to attachment directory. Check that the application server and JIRA have permissions to write to: /usr/local/tomcat/tomcat-jira/attachments/IO/IO-84"

Something along the following lines though:

    public static int copy(InputStream input, OutputStream output)
            throws IOException {
        long count = copyLarge(input, output);
        if (count > (long)Integer.MAX_VALUE) {
            throw new ArithmeticException("The byte count " + count + " is too large to be converted to an int");
        }
        return (int)count;
    }

    public static long copyLarge(InputStream input, OutputStream output)
            throws IOException {
        byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
        long count = 0;
        int n = 0;
        while (-1 != (n = input.read(buffer))) {
            output.write(buffer, 0, n);
            count += n;
        }
        return count;
    }


> Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams
> ---------------------------------------------------------------------------------------------
>
>                 Key: IO-84
>                 URL: http://issues.apache.org/jira/browse/IO-84
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 1.2
>         Environment: All
>            Reporter: Evgenii Philippov
>             Fix For: 1.3
>
>         Attachments: io-84-files-larger-than-2gb.patch
>
>
> java int.MAX_VALUE is 2 GB. Classes that handle streams larger than 2 GB will behave incorrectly.
> For example, see 
> http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java?view=markup
> Method: int copy(InputStream input, OutputStream output).
> The correct method would be: long copy(InputStream input, OutputStream output).
> This issue may affect many classes and routines.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (IO-84) Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams

Posted by "Stephen Colebourne (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/IO-84?page=all ]

Stephen Colebourne updated IO-84:
---------------------------------

    Component/s: Utilities

> Many classes are limited to length of stream < 2 GB, and behave incorrectly on larger streams
> ---------------------------------------------------------------------------------------------
>
>                 Key: IO-84
>                 URL: http://issues.apache.org/jira/browse/IO-84
>             Project: Commons IO
>          Issue Type: Bug
>          Components: Utilities
>    Affects Versions: 1.2
>         Environment: All
>            Reporter: Evgenii Philippov
>             Fix For: 1.3
>
>
> java int.MAX_VALUE is 2 GB. Classes that handle streams larger than 2 GB will behave incorrectly.
> For example, see 
> http://svn.apache.org/viewvc/jakarta/commons/proper/io/trunk/src/java/org/apache/commons/io/IOUtils.java?view=markup
> Method: int copy(InputStream input, OutputStream output).
> The correct method would be: long copy(InputStream input, OutputStream output).
> This issue may affect many classes and routines.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org