Skip to content

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

Closed
@azmras

Description

@azmras

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis issue is a bug.pending-releaseThis issue will be fixed by an approved PR that hasn't been released yet.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions