Conversation
SAMPLE 테이블은 NAME 을 VARCHAR(50), REG_USER 를 VARCHAR(10) 으로 두는데 등록 폼은 두 필드에 maxlength 60 을 내보낸다. 브라우저가 통과시킨 입력이 INSERT 에서 data exception: string data, right truncation 으로 죽고 화면은 오류 페이지가 되어 입력이 사라진다. 같은 폼의 description 은 maxlength 200 으로 DESCRIPTION VARCHAR(200) 과 맞고 id 는 maxlength 10 으로 ID VARCHAR(16) 안에 든다. 폼 maxlength 와 DDL 컬럼폭을 대조하는 테스트를 함께 넣는다.
jei007
approved these changes
Sep 9, 2026
jei007
left a comment
Contributor
There was a problem hiding this comment.
표준프레임워크에 대한 지속적인 참여에
대단히 감사드립니다.
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.
수정 사유 Reason for modification
소스를 수정한 사유가 무엇인지 체크해 주세요. Please check the reason you modified the source. ([X] X는 대문자여야 합니다.)
수정된 소스 내용 Modified source
검토자를 위해 수정된 소스 내용을 설명해 주세요. Please describe the modified source for reviewers.
문제
egovSampleRegister.jsp의name과regUser가SAMPLE테이블 컬럼폭보다 큰maxlength를 내보냅니다.등록자에 11자를 넣으면 브라우저는 통과시키고 INSERT 에서 죽습니다.
dispatcher-servlet.xml이DataAccessException을cmmn/dataAccessFailure로 보내 화면은Error Ocurred!만 남고 입력이 사라집니다.같은 폼의 형제 필드는 컬럼폭 안에 있습니다.
description은maxlength="200"으로DESCRIPTION VARCHAR(200)과 같고id는maxlength="10"으로ID VARCHAR(16)안에 듭니다.fc0f784이전에는 같은 폼이name을maxlength="30",regUser를maxlength="10"으로 두어 둘 다 컬럼폭 안이었습니다. 그 커밋이 DDL 은 그대로 둔 채 폼만 60 으로 올렸습니다.SampleVO에는@EgovNullCheck만 있어 서버가 길이를 보지 않고, 화면 검증validateSampleVO도required만 봅니다.수정
두 필드의
maxlength를 컬럼폭에 맞춥니다.regUser는 등록과 수정 두 분기에 있어 세 줄입니다.반대로
REG_USER를 넓히는 선택도 있습니다.7ba8fc9가DESCRIPTION을 100 에서 200 으로 넓혀 폼과 맞춘 전례가 있습니다. 이번에는 폼이 뒤늦게 벌어진 쪽이라 폼을 되돌렸고, DDL 을 넓히는 편이 낫다고 보시면 바꾸겠습니다.maxlength는 브라우저에서만 막으므로 API 를 직접 호출하면 여전히 같은 예외가 납니다. 서버에서도 막으려면SampleVO에@Size를 더하는 방법이 있고, 화면 쪽은EgovValidation.js가 이미 갖고 있는maxlength규칙을validateSampleVO에 걸면 됩니다. 폼과 DDL 을 맞추는 것과는 별개 결정이라 이번에는 넣지 않았고, 함께 넣는 편이 낫다고 보시면 추가하겠습니다.EgovSampleRegisterJspMaxLengthTest를 함께 넣었습니다.sampledb.sql에서 컬럼폭을 읽고 JSP 에서maxlength를 읽어 대조하는 테스트입니다. JSP 세 줄만 남기는 편을 선호하시면 빼겠습니다.JUnit 테스트 JUnit tests
테스트를 완료하셨으면 다음 항목에 [대문자X]로 표시해 주세요. When you're done testing, check the following items.
pom.xml의 surefire 설정이<skipTests>true</skipTests>이고 CI(.github/workflows/maven.yml)도-Dmaven.test.skip=true라 PR 체크에는 테스트가 나오지 않습니다. 아래는skipTests를false로 두고mvn -Ptest test로 돌린 결과입니다. EL 구현체expressly가test프로필에만 선언돼 있어 이 저장소의 컨텍스트 테스트가 그 프로필을 요구합니다.수정 전
수정 후
전체 스위트는 같은 워크트리에서 이 수정만 토글해 대조했습니다. 수정 있음
Tests run: 10, Failures: 0, 수정 없음Tests run: 10, Failures: 1이고 그 1건이 위 테스트입니다.테스트 브라우저 Test Browser
테스트를 진행한 브라우저를 선택해 주세요. Please select the browser(s) you ran the test on. (다중 선택 가능 you can select multiple) [X] X는 대문자여야 합니다.
mvn package로 만든 WAR 를tomcat:10.1-jdk17-temurin에 올리고 명령행 HTTP 클라이언트로 확인했습니다.테스트 스크린샷 또는 캡처 영상 Test screenshots or captured video
테스트 전과 후의 스크린샷 또는 캡처 영상을 이곳에 첨부해 주세요. Please attach screenshots or video captures of your before and after tests here.
스크린샷 대신
POST /addSampleView.do응답에서 뽑은 속성값을 옮깁니다.수정 전 상태에서 등록자에 11자를 넣고
POST /addSample.do하면 위 예외와 함께Error화면이 나오고, 8자는302로 정상 등록됩니다.