diff --git a/core/server/proxy/src/main/java/alluxio/proxy/s3/S3RestServiceHandler.java b/core/server/proxy/src/main/java/alluxio/proxy/s3/S3RestServiceHandler.java index 7d7968eefdfa..465b0f074a4a 100644 --- a/core/server/proxy/src/main/java/alluxio/proxy/s3/S3RestServiceHandler.java +++ b/core/server/proxy/src/main/java/alluxio/proxy/s3/S3RestServiceHandler.java @@ -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);