You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Michael Osipov (JIRA)" <ji...@apache.org> on 2017/01/09 21:19:58 UTC
[jira] [Updated] (WAGON-485) ScpWagon file size parsing to int
causes overflow for large files
[ https://issues.apache.org/jira/browse/WAGON-485?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Osipov updated WAGON-485:
---------------------------------
Summary: ScpWagon file size parsing to int causes overflow for large files (was: Integer Filesize)
> ScpWagon file size parsing to int causes overflow for large files
> -----------------------------------------------------------------
>
> Key: WAGON-485
> URL: https://issues.apache.org/jira/browse/WAGON-485
> Project: Maven Wagon
> Issue Type: Bug
> Components: wagon-ssh
> Affects Versions: 2.10
> Reporter: Silvio Assuncao
> Assignee: Michael Osipov
> Priority: Critical
> Fix For: 2.12
>
>
> {{ScpWagon}} class parses a string value to integer (file size) but if you have a large file (3.6 GB for example) the file size is 3865470566 in bytes, the number is larger than the {{MAX_VALUE}} of integer.
> {code:title=ScpWagon.java|borderStyle=solid}
> public void fillInputData( InputData inputData )
> throws TransferFailedException, ResourceDoesNotExistException {
> ...
> int filesize = Integer.valueOf( line.substring( 5, index ) ).intValue();
> fireTransferDebug( "Remote file size: " + filesize );
> resource.setContentLength( filesize );
> ...
> {code}
> I changed the line to parse using {{Long}} because the *resource.setContentLength* method receive a long value too.
> {code:title=ScpWagon.java|borderStyle=solid}
> long filesize = Long.valueOf( line.substring( 5, index ) );
> {code}
> Please check the pull-request https://github.com/apache/maven-wagon/pull/32
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)