Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NumberFormatException when parsing "Content-Length" -- should be long instead of int #963

Closed
azmras opened this issue Dec 18, 2018 · 5 comments
Labels
bug This issue is a bug. pending-release This issue will be fixed by an approved PR that hasn't been released yet.

Comments

@azmras
Copy link

azmras commented Dec 18, 2018

java.lang.NumberFormatException: For input string: "51747932945"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
at java.lang.Integer.parseInt(Integer.java:583)
at java.lang.Integer.valueOf(Integer.java:766)
at software.amazon.awssdk.services.s3.internal.handlers.SyncChecksumValidationInterceptor.modifyHttpResponseContent(SyncChecksumValidationInterceptor.java:84)

Possible Solution

in SyncChecksumValidationInterceptor.modifyHttpResponseContent
replace int with long

long contentLength = Long.valueOf(context.httpResponse().firstMatchingHeader(CONTENT_LENGTH_HEADER).orElse("0"));

in AsyncChecksumValidationInterceptor.modifyAsyncHttpResponseContent
replace int with long

long contentLength = Long.parseLong(context.httpResponse().firstMatchingHeader("Content-Length").orElse("0"));

Steps to Reproduce (for bugs)

use S3Client.getObject for large files (more than 2GB)

Context

Downloading a 50+ GB File

Your Environment

  • AWS Java SDK version used: 2.2.0
  • JDK version used: 1.8
  • Operating System and version: Amazon Linux 1
@zoewangg
Copy link
Contributor

Thank you for reporting! The fix has been merged and we will let you know after a release is out.

@azmras
Copy link
Author

azmras commented Dec 19, 2018

That was quick, waiting for release...
Thanks alot ...

@zoewangg
Copy link
Contributor

The temporary workaround is to disable S3 checksum validation via S3Configuration.Builder#checksumValidationEnabled

Builder checksumValidationEnabled(Boolean checksumValidationEnabled);

@azmras azmras closed this as completed Dec 20, 2018
@justnance justnance added pending-release This issue will be fixed by an approved PR that hasn't been released yet. and removed awaiting-release labels Apr 19, 2019
@metadaddy
Copy link

Did this make it into a release of the SDK yet? Seems to have been waiting a while!

@debora-ito
Copy link
Member

@metadaddy yes, it was released in version 2.3.0.

aws-sdk-java-automation pushed a commit that referenced this issue Sep 18, 2020
Revert "Changes document error root definition for XML based errors t…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. pending-release This issue will be fixed by an approved PR that hasn't been released yet.
Projects
None yet
Development

No branches or pull requests

5 participants