Skip to content

Commit

Permalink
#21 fix : soutv로그 삭제 & 모든 에러 처리 runtimeException 투척
Browse files Browse the repository at this point in the history
  • Loading branch information
jinno321 committed Oct 1, 2024
1 parent 773bf40 commit 5dc0e17
Showing 1 changed file with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,19 +256,17 @@ public HashMap<String, String> getPdfMetadata( String pdfUrl) {
metadata = new HashMap<>(response.metadata());

if (metadata.isEmpty()) {
System.out.println("No user-defined metadata found for this object.");
throw new RuntimeException("No user-defined metadata found for this object.");
}

} catch (S3Exception e) {
System.err.println("Failed to retrieve metadata: " + e.getMessage());
return new HashMap<>();
throw new RuntimeException("Failed to retrieve metadata: " + e.getMessage());
}

return metadata;
}

public String getMetadataForPage(String pdfUrl, int pageNumber) {
System.out.println("pdfUrl = " + pdfUrl);
String fileName = extractKeyFromUrl(pdfUrl);

GetObjectRequest getRequest = GetObjectRequest.builder()
Expand All @@ -280,7 +278,6 @@ public String getMetadataForPage(String pdfUrl, int pageNumber) {

Map<String, String> metadata = getObjectResponse.metadata();
HashMap<String, String> decodedMetadata = decodeMetadata(metadata);
System.out.println("decodedMetadata = " + decodedMetadata);

String pageKey = "page-" + pageNumber;

Expand Down Expand Up @@ -340,7 +337,7 @@ public void deletePdf(String urlToDelete) {
.key(key)
.build());
} catch (S3Exception e) {
System.err.println("Failed to delete photo from S3: " + e.getMessage());
throw new RuntimeException("Failed to delete photo from S3: " + e.getMessage());
}
}

Expand Down Expand Up @@ -405,7 +402,6 @@ private HashMap<String, String> changeForNewMetadata(int pageNumberToRemove, Has
newPageNumbers.add(pageNumber);
}
}
System.out.println("pageSize = " + pageSize);

// 새로운 메타데이터 해시맵 생성
HashMap<String, String> newMetadata = new HashMap<>();
Expand Down

0 comments on commit 5dc0e17

Please sign in to comment.