com.amazonaws.AmazonClientException: Data read has a different length than the expected: dataLength=0; expectedLength=26; includeSkipped=false; in.getClass()=class com.amazonaws.internal.ResettableInputStream; markedSupported=true; marked=0; resetSinceLastMarked=false; markCount=1; resetCount=0

Spring JIRA | John Logan | 8 months ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    S3MessageHandler upload fails for File message.

    GitHub | 8 months ago | jglogan
    com.amazonaws.AmazonClientException: Data read has a different length than the expected: dataLength=0; expectedLength=26; includeSkipped=false; in.getClass()=class com.amazonaws.internal.ResettableInputStream; markedSupported=true; marked=0; resetSinceLastMarked=false; markCount=1; resetCount=0
  2. 0

    https://github.com/spring-projects/spring-integration-aws/issues/41 I have configured an `S3MessageHandler` from spring-integration-aws to upload a `File` object to S3. The upload fails with the following trace: > Caused by: com.amazonaws.AmazonClientException: Data read has a different length than the expected: dataLength=0; expectedLength=26; includeSkipped=false; in.getClass()=class com.amazonaws.internal.ResettableInputStream; markedSupported=true; marked=0; resetSinceLastMarked=false; markCount=1; resetCount=0 at com.amazonaws.util.LengthCheckInputStream.checkLength(LengthCheckInputStream.java:152) ... Looking at the source code for `S3MessageHandler`, I'm not sure how uploading a `File` would ever succeed. The `s3MessageHandler.upload()` method does the following when I trace its execution: - Creates a FileInputStream for the File. - Computes the MD5 hash for the file contents, using the input stream. - Resets the stream if it can be reset (not possible for FileInputStream). - Sets up the S3 transfer using the input stream. This fails because the stream is at the EOF, so the number of transferable bytes doesn't match what's in the Content-Length header.

    Spring JIRA | 8 months ago | John Logan
    com.amazonaws.AmazonClientException: Data read has a different length than the expected: dataLength=0; expectedLength=26; includeSkipped=false; in.getClass()=class com.amazonaws.internal.ResettableInputStream; markedSupported=true; marked=0; resetSinceLastMarked=false; markCount=1; resetCount=0
  3. 0

    Cannot upload log files that are being appended to during upload

    GitHub | 9 months ago | pako-pl
    com.amazonaws.AmazonClientException: More data read than expected: dataLength=48170; expectedLength=47956; includeSkipped=false; in.getClass()=class com.amazonaws.internal.ReleasableInputStream; markedSupported=false; marked=0; resetSinceLastMarked=false; markCount=0; resetCount=0
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    AmazonClientException: Data read has a different length than the expected

    Stack Overflow | 2 years ago | Mangesh Bhapkar
    com.amazonaws.AmazonClientException: Data read has a different length than the expected: dataLength=8192; expectedLength=79352; includeSkipped=false; in.getClass()=class com.amazonaws.internal.ResettableInputStream; markedSupported=true; marked=0; resetSinceLastMarked=false; markCount=1; resetCount=0
  6. 0

    AmazonClientException: Data read has a different length than the expected

    programwith.com | 1 year ago
    com.amazonaws.AmazonClientException: Data read has a different length than the expected: dataLength=8192; expectedLength=79352; includeSkipped=false; in.getClass()=class com.amazonaws.internal.ResettableInputStream; markedSupported=true; marked=0; resetSinceLastMarked=false; markCount=1; resetCount=0

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. com.amazonaws.AmazonClientException

      Data read has a different length than the expected: dataLength=0; expectedLength=26; includeSkipped=false; in.getClass()=class com.amazonaws.internal.ResettableInputStream; markedSupported=true; marked=0; resetSinceLastMarked=false; markCount=1; resetCount=0

      at com.amazonaws.util.LengthCheckInputStream.checkLength()
    2. AWS SDK for Java - Core
      LengthCheckInputStream.checkLength
      1. com.amazonaws.util.LengthCheckInputStream.checkLength(LengthCheckInputStream.java:152)
      1 frame