diff --git a/web3-credential-server/build/tmp/compileJava/previous-compilation-data.bin b/web3-credential-server/build/tmp/compileJava/previous-compilation-data.bin index f4ee953..3db4634 100644 Binary files a/web3-credential-server/build/tmp/compileJava/previous-compilation-data.bin and b/web3-credential-server/build/tmp/compileJava/previous-compilation-data.bin differ diff --git a/web3-credential-server/src/main/java/web3/s3Storage/service/S3StorageService.java b/web3-credential-server/src/main/java/web3/s3Storage/service/S3StorageService.java index 6980af4..87c1bb5 100644 --- a/web3-credential-server/src/main/java/web3/s3Storage/service/S3StorageService.java +++ b/web3-credential-server/src/main/java/web3/s3Storage/service/S3StorageService.java @@ -342,9 +342,7 @@ public void deletePdfForPage(Wallet wallet, int pageNumberToRemove) throws IOExc int pageIndexToRemove = pageNumberToRemove - 1; // 페이지가 존재하는지 확인 - if (pageIndexToRemove < 0 || pageIndexToRemove >= totalPages) { - throw new IllegalArgumentException("Page number out of range: " + pageNumberToRemove); - } + checkPageExist(pageIndexToRemove < 0, pageIndexToRemove >= totalPages, "Page number out of range: " + pageNumberToRemove); byte[] frontPart = createPdfBytesPart(originalDocument, 0, pageIndexToRemove); byte[] backPart = createPdfBytesPart(originalDocument, pageIndexToRemove + 1, originalDocument.getNumberOfPages()); @@ -352,7 +350,7 @@ public void deletePdfForPage(Wallet wallet, int pageNumberToRemove) throws IOExc // PDF 합치기 byte[] finalPdfBytes = mergePdfs(frontPart,backPart); HashMap metadata = getPdfMetadata(fileName); - + log.info("metadata = {}",metadata); metadata.remove("page-" + pageNumberToRemove); // 최종 PDF를 S3에 업로드 @@ -366,6 +364,12 @@ public void deletePdfForPage(Wallet wallet, int pageNumberToRemove) throws IOExc } + private static void checkPageExist(boolean pageIndexToRemove, boolean pageIndexToRemove1, String pageNumberToRemove) { + if (pageIndexToRemove || pageIndexToRemove1) { + throw new IllegalArgumentException(pageNumberToRemove); + } + } + public ResponseInputStream getPdf(String pdfUrl) { String key = extractKeyFromUrl(pdfUrl); GetObjectRequest getObjectRequest = GetObjectRequest.builder()