fix: MessageConverterImpl 누락된 List/Record 필드 NullPointerException 방지#269
Open
z3rotig4r wants to merge 1 commit into
Open
fix: MessageConverterImpl 누락된 List/Record 필드 NullPointerException 방지#269z3rotig4r wants to merge 1 commit into
z3rotig4r wants to merge 1 commit into
Conversation
convertToValueObject()는 ListType·RecordType 분기에서 source를 각각 ((Collection) source).toArray(), ((Map) source).entrySet()로 역참조한다. 메시지 body에서 해당 List/Record 필드가 생략되면 source가 null로 전달되고, 타입 체계는 null을 유효한 값으로 허용하므로 단순 잘못된 입력으로 볼 수 없다. 이 경우 두 분기 모두 NullPointerException이 발생한다. 두 분기에서 역참조 전에 source가 null이면 null을 그대로 반환하도록 가드를 추가한다. 타입 체계가 허용하는 null 값 의미를 보존하며, 재귀로 처리되는 중첩 필드의 null도 안전하게 반환·대입된다. 테스트: convertToValueObject(null, listType/recordType)가 NPE 없이 null 반환 확인.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
배경
MessageConverterImpl.convertToValueObject()는ListType·RecordType분기에서source를 각각((Collection<?>) source).toArray(),((Map<String, Object>) source).entrySet()로 역참조합니다. 메시지 body에서 해당 List/Record 필드가 생략되면source가null로 전달되고, 타입 체계는null을 유효한 값으로 허용하므로 단순 잘못된 입력으로 볼 수 없습니다. 이 경우 두 분기 모두NullPointerException이 발생합니다.변경 내용
두 분기에서 역참조 전에
source가null이면null을 그대로 반환하도록 가드를 추가합니다. 타입 체계가 허용하는 null 값 의미를 보존하며, 재귀 호출로 처리되는 중첩 필드의 null도 안전하게 반환·대입됩니다.테스트
convertToValueObject(null, listType)와convertToValueObject(null, recordType)가NullPointerException없이null을 반환함을 확인하는 테스트를 추가했습니다. 수정 전에는 두 경우 모두 null 역참조로 실패합니다. 기존 변환 테스트도 그대로 통과합니다.영향
정상 값(non-null)의 변환 동작은 변경되지 않으며, 누락된 List/Record 필드에 대해서만 NPE 대신 null이 반환됩니다.