Java blobstore method completeMultipartUpload throw null pointer exception for checkNotNull

46 views Asked by At

I have a problem with saving .csv files by multi parts. In this part of the code:

@Override
public String completeMultipartUpload(MultipartUpload mpu, List<MultipartPart> parts) {
  ImmutableList.Builder<Blob> blobs = ImmutableList.builder();
  long contentLength = 0;
  Hasher md5Hasher = Hashing.md5().newHasher();

  for (MultipartPart part : parts) {
     Blob blobPart = getBlob(mpu.containerName(), MULTIPART_PREFIX + mpu.id() + "-" + mpu.blobName() + "-" + part.partNumber());
     contentLength += blobPart.getMetadata().getContentMetadata().getContentLength();
     blobs.add(blobPart);
     md5Hasher.putBytes(BaseEncoding.base16().lowerCase().decode(blobPart.getMetadata().getETag()));
  }

The problem occurs on my computer, the program works for other people. Namely, for a given part of the code, blobPart.getMetadata().GetETag() always for the first 9 parts work fine. And for part 10 and each subsequent part does return a null value for ETag, which then causes an error NullPointerException. All List<MultipartPart> parts are adding in the same way. All have correct property.

I think it is problem with my Environment. I tried:

  • reinstall IntelliJ
  • reinstall Java/use a different version
  • remove all libraries and install again

Or maybe something with encoding? Other people for which it works are from another country, and I can see there is BaseEncoding.base16()?

StackTrace:

java.lang.NullPointerException: null at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:878) at com.google.common.io.BaseEncoding$StandardBaseEncoding.trimTrailingPadding(BaseEncoding.java:676) at com.google.common.io.BaseEncoding.decodeChecked(BaseEncoding.java:231) at com.google.common.io.BaseEncoding.decode(BaseEncoding.java:217) at org.jclouds.blobstore.config.LocalBlobStore.completeMultipartUpload(LocalBlobStore.java:843)

1

There are 1 answers

0
Silny ToJa On

I hit perfectly the limit of the path length for windows, it threw an error because the path passed to UserDefinedFileAttributeView view = getUserDefinedFileAttributeView(file.toPath()); it was too long.