refactor: reactive 예외 클래스 message 필드 섀도잉 제거 및 serialVersionUID 추가#252
Open
z3rotig4r wants to merge 1 commit into
Open
refactor: reactive 예외 클래스 message 필드 섀도잉 제거 및 serialVersionUID 추가#252z3rotig4r wants to merge 1 commit into
z3rotig4r wants to merge 1 commit into
Conversation
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.
배경
org.egovframe.rte.ptl.reactive.exception패키지의EgovException과EgovServiceException은RuntimeException을 상속하면서protected String message필드를 별도로 선언해Throwable.message를 섀도잉했습니다. 생성자에서super(message)를 호출하지 않고 자체 필드에만 값을 저장한 뒤getMessage()를 오버라이드해 그 필드를 반환하는 구조였습니다.동작 자체는 유지됐으나, 표준
Throwable의 메시지가 설정되지 않아 메시지가 자체 필드 경로에만 존재하고, 필드 섀도잉이라는 코드 스멜이 남아 있었습니다. 또한 두 클래스 모두RuntimeException상속으로Serializable이지만serialVersionUID가 선언되어 있지 않았습니다.변경 내용
protected String message필드와getMessage()오버라이드를 제거하고, 생성자에서super(message)를 호출해 표준Throwable메시지로 전파하도록 변경했습니다.EgovException은 메시지 코드 분기를 보존했습니다:super(messageCode ? egovErrorCode.getMessage() : message).serialVersionUID를 추가해 SpotBugsSE_NO_SERIALVERSIONID경고를 해소했습니다. (예외 클래스의 표준 관례에 따른 정적분석 경고 해소이며, 직렬화 동작을 새로 활성화하거나 보장하는 변경은 아닙니다.)egovErrorCode필드,getEgovErrorCode(), 위임 생성자는 스코프를 한정하기 위해 변경하지 않았습니다.검증
getMessage()반환값이 변경 전과 동일함을 확인했습니다(동작 보존).EgovExceptionHandlerTest회귀 테스트가 통과했습니다.영향 범위
getMessage()반환값이 동일해 외부 동작은 보존됩니다.message필드를 직접 참조하는 외부 코드가 없음을 확인했습니다.Throwable메시지 전파, 필드 섀도잉 제거, 정적분석 경고 해소.