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: #17400
			change-id: cid-db0f6ac83b1f6de7937c17f82911b153fe63155d
  • Loading branch information
Jackson-Wang-7 authored and alluxio-bot committed Sep 5, 2024
1 parent e688433 commit 2d59983
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,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 2d59983

Please sign in to comment.