fix: EgovIndexFileWriter에 setResourceLoader 추가로 classpath 리소스 경로 NPE 방지#266
Open
z3rotig4r wants to merge 1 commit into
Open
fix: EgovIndexFileWriter에 setResourceLoader 추가로 classpath 리소스 경로 NPE 방지#266z3rotig4r wants to merge 1 commit into
z3rotig4r wants to merge 1 commit into
Conversation
EgovIndexFileWriter는 classpath 기반 indexResource를 해석할 때 configureWriterIndexResouce()에서 resourceLoader.getResource()를 호출하지만, 이 필드를 주입할 경로가 없다. ResourceLoaderAware를 구현하지도 않고 세터도 없어 필드가 항상 null로 남고, classpath 경로 사용 시 NullPointerException이 발생한다. 형제 클래스 EgovIndexFileReader는 동일 목적의 setResourceLoader(ResourceLoader)를 이미 제공한다. Writer에도 동일한 세터를 추가해 classpath 경로가 정상 해석되도록 한다. 파일시스템 경로 분기는 ResourceLoader를 사용하지 않으므로 영향이 없다. 테스트: 미주입 시 NPE 재현, 주입 후 classpath 경로 정상 해석(resource 설정), 세터 존재 확인.
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.
배경
EgovIndexFileWriter는 classpath 기반indexResource를 해석할 때configureWriterIndexResouce()에서resourceLoader.getResource(...)를 호출합니다. 그러나 이 클래스에는resourceLoader필드를 주입할 수 있는 경로가 없습니다.ResourceLoaderAware를 구현하지도 않고 세터도 없어 필드가 항상null로 남고, classpath 경로를 사용하면NullPointerException이 발생합니다.형제 클래스
EgovIndexFileReader는 동일한 목적의setResourceLoader(ResourceLoader)를 이미 제공합니다. Writer에만 이 주입 경로가 빠져 있습니다.변경 내용
EgovIndexFileReader와 동일하게EgovIndexFileWriter에setResourceLoader(ResourceLoader)를 추가합니다. 파일시스템 경로 분기는ResourceLoader를 사용하지 않으므로 영향이 없고, classpath 경로에서만 주입된 로더로 정상 해석됩니다.테스트
ResourceLoader미주입 시 classpathindexResource해석에서NullPointerException이 발생함을 확인(버그 재현).ResourceLoader주입 후 classpath 경로가 정상 해석되어resource가 설정됨을 확인.영향
기존 코드를 수정하지 않고 setter를 추가하기만 하는 변경입니다. 기존 파일시스템 경로 사용자는 영향받지 않으며, classpath 경로 사용 시에만 새 주입 경로가 동작합니다.