Skip to content

Commit 70edeec

Browse files
committed
fix: ObjectMapper 사용 시 발생하는 unchecked 경고 제거
- TypeReference<Map<String, Object>>를 사용하여 JSON 역직렬화 과정에서 발생하는 경고를 제거
1 parent a72e25a commit 70edeec

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/main/java/com/somemore/global/aspect/log/utils/SensitiveDataMasker.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.somemore.global.aspect.log.utils;
22

33
import com.fasterxml.jackson.core.JsonProcessingException;
4+
import com.fasterxml.jackson.core.type.TypeReference;
45
import com.fasterxml.jackson.databind.ObjectMapper;
56
import lombok.extern.slf4j.Slf4j;
67
import org.springframework.stereotype.Component;
@@ -56,7 +57,7 @@ private Map<String, Object> maskSensitiveDataInMap(Map<?, ?> map) {
5657

5758
private String maskSensitiveDataInJson(String json, ObjectMapper objectMapper) {
5859
try {
59-
Map<String, Object> jsonMap = objectMapper.readValue(json, Map.class);
60+
Map<String, Object> jsonMap = objectMapper.readValue(json, new TypeReference<>() {});
6061
Map<String, Object> maskedMap = maskSensitiveDataInMap(jsonMap);
6162
return objectMapper.writeValueAsString(maskedMap);
6263
} catch (Exception e) {

0 commit comments

Comments
 (0)