最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin2浏览0评论

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;
    }
}

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论