JSONMessage 파서에 선행 0 숫자 허용 옵션 추가

비표준(N) 경로도 표준(K) 경로와 같은 입력에서 실패한다.
JSONMessage 는 ALLOW_UNESCAPED_CONTROL_CHARS 만 켜고 있어 제어문자는
통과했지만, 선행 0 은 별개 옵션이라 함께 거부됐다.

transformer 는 의존 방향(common -> transformer)상 JacksonUtil 을 참조할 수
없어 common 의 newNumberSafeMapper() 와 같은 설정을 직접 켠다.

주의: 이 옵션은 00001 을 숫자 1 로 만든다(선행 0 미보존).

Jackson 2.12.7 실측: 생성자와 동일한 4개 설정 조합에서 선행 0 파싱,
제어문자 옵션 유지, 두 옵션 동시 동작, 숫자 정밀도 왕복 모두 확인.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Phh6MSGvgHM3rPgGUU3dzR
This commit is contained in:
curry772
2026-08-28 16:41:31 +09:00
parent c0c1544350
commit eaf1416e13
@@ -50,6 +50,12 @@ public class JSONMessage extends Message {
factory = mapper.getFactory(); factory = mapper.getFactory();
factory.configure(JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS.mappedFeature(), true); factory.configure(JsonReadFeature.ALLOW_UNESCAPED_CONTROL_CHARS.mappedFeature(), true);
// 상대가 0 패딩된 코드값을 따옴표 없이(=JSON 숫자로) 보내면 표준 파서는
// "Invalid numeric value: Leading zeroes not allowed" 로 거부한다.
// 전문 자체를 못 읽는 것보다 받아들이는 쪽이 낫다고 판단해 허용한다.
// ⚠ 이 옵션은 00001 을 숫자 1 로 만든다(선행 0 미보존).
// 표준전문 경로(common JacksonUtil.newNumberSafeMapper)와 동일한 설정이다.
factory.configure(JsonReadFeature.ALLOW_LEADING_ZEROS_FOR_NUMBERS.mappedFeature(), true);
} }
@Override @Override