4545import com .google .common .collect .ImmutableMap ;
4646import com .google .common .collect .ImmutableSortedSet ;
4747import com .google .common .hash .HashCode ;
48+ import com .google .common .hash .HashFunction ;
4849import com .google .common .hash .Hashing ;
4950import com .google .common .hash .HashingInputStream ;
5051import com .google .common .io .BaseEncoding ;
@@ -111,8 +112,10 @@ public abstract class AbstractNio2BlobStore extends BaseBlobStore {
111112 private static final String XATTR_USER_METADATA_PREFIX =
112113 "user.user-metadata." ;
113114 private static final String MULTIPART_PREFIX = ".mpus-" ;
115+ @ SuppressWarnings ("deprecation" )
116+ private static final HashFunction md5 = Hashing .md5 ();
114117 private static final byte [] DIRECTORY_MD5 =
115- Hashing . md5 () .hashBytes (new byte [0 ]).asBytes ();
118+ md5 .hashBytes (new byte [0 ]).asBytes ();
116119
117120 private final Supplier <Set <? extends Location >> locations ;
118121 private final Path root ;
@@ -469,6 +472,7 @@ public final Blob getBlob(String container, String key, GetOptions options) {
469472 if (options .getIfModifiedSince () != null ) {
470473 Date modifiedSince = options .getIfModifiedSince ();
471474 if (lastModifiedTime .before (modifiedSince )) {
475+ @ SuppressWarnings ("rawtypes" )
472476 HttpResponse .Builder response = HttpResponse .builder ().statusCode (Status .NOT_MODIFIED .getStatusCode ());
473477 if (eTag != null ) {
474478 response .addHeader (HttpHeaders .ETAG , eTag );
@@ -480,6 +484,7 @@ public final Blob getBlob(String container, String key, GetOptions options) {
480484 if (options .getIfUnmodifiedSince () != null ) {
481485 Date unmodifiedSince = options .getIfUnmodifiedSince ();
482486 if (lastModifiedTime .after (unmodifiedSince )) {
487+ @ SuppressWarnings ("rawtypes" )
483488 HttpResponse .Builder response = HttpResponse .builder ().statusCode (Status .PRECONDITION_FAILED .getStatusCode ());
484489 if (eTag != null ) {
485490 response .addHeader (HttpHeaders .ETAG , eTag );
@@ -571,7 +576,7 @@ public final String putBlob(String container, Blob blob, PutOptions options) {
571576 }
572577
573578 var metadata = blob .getMetadata ().getContentMetadata ();
574- try (var is = new HashingInputStream (Hashing . md5 () , blob .getPayload ().openStream ());
579+ try (var is = new HashingInputStream (md5 , blob .getPayload ().openStream ());
575580 var os = Files .newOutputStream (tmpPath )) {
576581 var count = is .transferTo (os );
577582 var actualHashCode = is .hash ();
@@ -845,7 +850,7 @@ public final void abortMultipartUpload(MultipartUpload mpu) {
845850 public final String completeMultipartUpload (MultipartUpload mpu , List <MultipartPart > parts ) {
846851 var metas = ImmutableList .<BlobMetadata >builder ();
847852 long contentLength = 0 ;
848- var md5Hasher = Hashing . md5 () .newHasher ();
853+ var md5Hasher = md5 .newHasher ();
849854
850855 for (var part : parts ) {
851856 var meta = blobMetadata (mpu .containerName (), MULTIPART_PREFIX + mpu .id () + "-" + mpu .blobName () + "-" + part .partNumber ());
0 commit comments