Skip to content

Commit

Permalink
Avoid the NPE exception in copy object with x-amz-tagging-directive
Browse files Browse the repository at this point in the history
### What changes are proposed in this pull request?

Avoid the NPE exception in copy object with x-amz-tagging-directive

### Why are the changes needed?
Avoid the NPE exception

			pr-link: Alluxio#17400
			change-id: cid-db0f6ac83b1f6de7937c17f82911b153fe63155d
  • Loading branch information
Jackson-Wang-7 authored and codings-dan committed Dec 21, 2023
1 parent c286187 commit faf84a2
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,14 @@ public Response createObjectOrUploadPart(@HeaderParam("Content-MD5") final Strin
throw new S3Exception("Copying an object to itself invalid.",
objectPath, S3ErrorCode.INVALID_REQUEST);
}
// avoid the NPE of status
try {
if (status == null) {
status = userFs.getStatus(new AlluxioURI(copySource));
}
} catch (Exception e) {
throw S3RestUtils.toObjectS3Exception(e, objectPath, auditContext);
}
try (FileInStream in = userFs.openFile(new AlluxioURI(copySource));
RangeFileInStream ris = RangeFileInStream.Factory.create(in, status.getLength(),
s3Range);
Expand Down

0 comments on commit faf84a2

Please sign in to comment.