java - How to get rid of the warning "Not all bytes were read from the S3ObjectInputStream, aborting HTTP connection.&a

I have the following code, which is used by the s3 object, but perhaps there will be a wait after the r

I have the following code, which is used by the s3 object, but perhaps there will be a wait after the return: Not all bytes were read from the S3ObjectInputStream, aborting HTTPconnection. This is likely an error and may result in suboptimal behavior. Request only the bytes you need is a ranged GET or drain the input stream after use. How do I get rid of this warning? As you can see, I have already tried to use ranged get

public CheckMimeTypeResult isValidObjectInQuarantineBucket(String bucket, String key) {
    GetObjectRequest request = new GetObjectRequest(bucket, key)
        .withRange(0, 1);
    try (S3Object s3Object = s3client.getObject(request)) {
        String mimeType = getMimeType(s3Object);
        CheckMimeTypeResult result = isSupportedMimeType(mimeType) ?
            checkMimeType(key, mimeType) : new CheckMimeTypeResult(false, false, mimeType);

        log.debug("isValidObjectInQuarantineBucket() - end: key = {}, result = {}", key, result);
        return result;
    } catch (Exception ex) {
        log.warn("Could not detect mime type for key {}. ex = {}", key, ex.getMessage(), ex);
        CheckMimeTypeResult result = new CheckMimeTypeResult(false, false, null);

        log.debug("isValidObjectInQuarantineBucket() - end: key = {}, result = {}", key, result);
        return result;
    }
}

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745355226a4624074.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信