cameronhunter/glacier-cli

GlacierDownload.java off-by-one index

Closed this issue · 3 comments

Looks like this block in GlacierDownload.java:

@Override
protected void execute( Glacier glacier, List<String> parameters ) throws Exception {
    String vault = parameters.get( 1 );
    String archiveId = parameters.get( 2 );
    String target = parameters.get( 3 );

    File archive = glacier.download( vault, archiveId ).get();
    archive.renameTo( new File( target ) );
}

should be changed to this:

@Override
protected void execute( Glacier glacier, List<String> parameters ) throws Exception {
    String vault = parameters.get( 0 );
    String archiveId = parameters.get( 1 );
    String target = parameters.get( 2 );

    File archive = glacier.download( vault, archiveId ).get();
    archive.renameTo( new File( target ) );
}

(only change is index values for the parameters.get calls)

Otherwise downloads fail with an array index out of bounds error.

After making this change, downloads are at least submitted without error to aws.

Nice job on your project!

Yep, definite bug! It used to be that the first parameter in the list was the "action" to perform, but this has since been abstracted away by GlacierAll.java. Do you want to create a pull request? I can sort it myself if you want.

Thanks, Cameron

Fixed it now - give release 3.2.1 a go. Thanks again, C

Thanks!

On Nov 22, 2012, at 10:08 PM, Cameron Hunter notifications@github.com wrote:

Fixed it now - give release 3.2.1 a go. Thanks again, C


Reply to this email directly or view it on GitHub.