Skip to content

refactor: reactive 예외 클래스 message 필드 섀도잉 제거 및 serialVersionUID 추가#252

Open
z3rotig4r wants to merge 1 commit into
eGovFramework:mainfrom
z3rotig4r:refactor/reactive-exception-message-shadowing
Open

refactor: reactive 예외 클래스 message 필드 섀도잉 제거 및 serialVersionUID 추가#252
z3rotig4r wants to merge 1 commit into
eGovFramework:mainfrom
z3rotig4r:refactor/reactive-exception-message-shadowing

Conversation

@z3rotig4r

Copy link
Copy Markdown
Contributor

배경

org.egovframe.rte.ptl.reactive.exception 패키지의 EgovExceptionEgovServiceExceptionRuntimeException을 상속하면서 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를 추가해 SpotBugs SE_NO_SERIALVERSIONID 경고를 해소했습니다. (예외 클래스의 표준 관례에 따른 정적분석 경고 해소이며, 직렬화 동작을 새로 활성화하거나 보장하는 변경은 아닙니다.)
  • egovErrorCode 필드, getEgovErrorCode(), 위임 생성자는 스코프를 한정하기 위해 변경하지 않았습니다.

검증

  • 모든 생성자에서 getMessage() 반환값이 변경 전과 동일함을 확인했습니다(동작 보존).
  • 신규 단위테스트 7건을 추가하고 기존 EgovExceptionHandlerTest 회귀 테스트가 통과했습니다.
  • 모듈 테스트 9건 전부 통과했습니다.

영향 범위

  • getMessage() 반환값이 동일해 외부 동작은 보존됩니다.
  • 두 예외 클래스를 상속하는 서브클래스나 message 필드를 직접 참조하는 외부 코드가 없음을 확인했습니다.
  • 개선점: 표준 Throwable 메시지 전파, 필드 섀도잉 제거, 정적분석 경고 해소.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant