fix: EgovEscapableDelimitedLineTokenizer가 $ 구분자에서 던지는 Illegal group reference 예외 제거#277
Open
z3rotig4r wants to merge 1 commit into
Open
Conversation
…reference 예외 제거
getRegexDelimiter()는 정규식 특수문자를 이스케이프하는데, 남아 있던
replaceAll("[\$]", "[\$]")의 replacement 문자열에서 \$는 그룹 참조 특수문자로
해석된다. \$ 뒤에 숫자가 아닌 ]가 오므로 setDelimiter("\$") 호출 시
IllegalArgumentException: Illegal group reference 가 발생했다.
이 파일이 2023년에 replaceAll을 replace로 바꾼 것과 동일하게, 남은 네 줄도
리터럴 replace로 변경한다(단일 문자 치환으로 동작 동일, 그룹 참조 문제 제거).
\$ 구분자 설정과 토큰 분리가 예외 없이 동작하는지 검증하는 테스트 추가
(수정 전 Illegal group reference 재현).
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.
문제
getRegexDelimiter()는 구분자에 포함된 정규식 특수문자를 이스케이프합니다. 그런데 남아 있던replaceAll("[$]", "[$]")의 replacement 문자열에서$는 그룹 참조 특수문자로 해석됩니다.$뒤에 숫자가 아닌]가 오므로,setDelimiter("$")호출 시IllegalArgumentException: Illegal group reference가 발생합니다.setDelimiter는 public 호출 경로이며, 같은 줄의[*]·[+]·[|]는 replacement에$가 없어 예외가 없고$만 문제입니다.수정
이 파일이 2023년에 다른
replaceAll을replace로 바꾼 것과 동일하게, 남은 네 줄도 리터럴replace로 변경했습니다. 단일 문자 치환이라 동작은 같고 그룹 참조 문제만 제거됩니다.검증
$구분자 설정과 토큰 분리가 예외 없이 동작하는지 검증하는 단위 테스트를 추가했습니다(수정 전에는Illegal group reference재현).