fix: ReviewDetailV1 NPE 위험 수정 - #402
Conversation
feat: 컴파일러에 Java 17로 빌드 명시
feat: main 브랜치 ci/cd기능 적용
feat: 토큰 유효성 검사 API 개발
refactor: access token 없이 토큰 인증할수 있게 수정
feat: 로그인시 Warmup Runner추가
feat: 리뷰 v2 mealId, menuId별 리뷰, 평점 조회
feat: 모니터링 의존성 추가, management 추가
…e-review feat: Claude Code .claude 설정 개편 (rules 디렉토리 신설 및 review 커맨드 이름 변경)
resolved #385 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
코드 리뷰 반영: EATSSU_JWT_SECRET_TEST 하드코딩 값 제거, openssl로 매 실행마다 생성 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
resolved #387 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
fix: Ratings 생성 시 평점 값이 null이면 NPE 발생하던 문제 수정
resolved #388 BaseResponseStatus의 INVALID_START/END_OF_NICKNAME 메시지에 숫자가 허용 문자로 명시되어 있어, 실제 구현(정규식)이 아니라 테스트의 기대값이 스펙과 어긋나 있었음 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
test: 닉네임 시작/끝 숫자 허용 스펙에 맞게 NicknameValidatorTest 기대값 수정
feat: PR 생성 시 테스트 자동 실행하는 CI 워크플로우 추가
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
feat: 다국어 번역 데이터 추가 및 고정메뉴 다국어 지원
…migrations fix: 누락된 Flyway migration 파일 복구
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…-v14-schema fix: prod flyway 마이그레이션 누락 및 V14 스키마 하드코딩 수정
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 본 PR은 V2 리뷰 데이터 구조와 호환되는 리뷰 조회 시 발생하는 NPE 문제를 해결합니다. Ratings 객체가 없는 경우에도 V1 응답 모델이 정상적으로 데이터를 처리할 수 있도록 null 체크 로직을 추가하여 시스템 안정성을 높였습니다. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. 리뷰의 별점 확인하려다, 널(null)을 만나 멈춰버린 코드. 안전하게 확인하고, 다시 흐르는 서비스의 길. Footnotes
|
There was a problem hiding this comment.
Code Review
이번 풀 리퀘스트는 ReviewDetailV1 DTO에서 ratings 객체가 null일 때 발생할 수 있는 NullPointerException을 방지하기 위해 null 검사를 추가하고, 기본값으로 review.getRating()을 사용하도록 수정하였습니다. 이에 대해 ratings와 review.getRating()이 모두 null인 경우 mainRating이 null이 될 수 있으므로 Objects.requireNonNull 등을 사용해 null 검증을 하거나 기본값을 제공하라는 피드백이 있었습니다.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| Ratings ratings = review.getRatings(); | ||
| Integer mainRating = (ratings != null) ? ratings.getMainRating() : review.getRating(); | ||
| Integer amountRating = (ratings != null) ? ratings.getAmountRating() : null; | ||
| Integer tasteRating = (ratings != null) ? ratings.getTasteRating() : null; |
There was a problem hiding this comment.
[pooreumjung, 2026-07-09] ratings와 review.getRating()이 모두 null인 경우 mainRating이 null이 될 수 있으므로, Objects.requireNonNull 등을 사용하여 null 검증을 하거나 기본값을 제공하는 것이 안전합니다.
| Ratings ratings = review.getRatings(); | |
| Integer mainRating = (ratings != null) ? ratings.getMainRating() : review.getRating(); | |
| Integer amountRating = (ratings != null) ? ratings.getAmountRating() : null; | |
| Integer tasteRating = (ratings != null) ? ratings.getTasteRating() : null; | |
| Ratings ratings = review.getRatings(); | |
| Integer mainRating = (ratings != null) ? ratings.getMainRating() : java.util.Objects.requireNonNull(review.getRating(), "Rating must not be null"); | |
| Integer amountRating = (ratings != null) ? ratings.getAmountRating() : null; | |
| Integer tasteRating = (ratings != null) ? ratings.getTasteRating() : null; |
#️⃣ Issue Number
📝 요약(Summary)
ReviewDetailV1.from()이review.getRatings()가 null일 때(V2 경로로 생성되어rating필드만 채워진 리뷰)getMainRating()호출에서 NPE가 발생하던 문제를 수정했습니다.ReviewDetail.from()에 이미 있던rating != null ? rating : ratings.getMainRating()null-safe 패턴을 V1에도 동일하게 적용했습니다.ratings가 null인 경우amountRating/tasteRating은 V2 리뷰에 애초에 값이 없으므로 그대로 null을 반환합니다.💬 공유사항 to 리뷰어
Review.ratings/Review.rating이 서로 배타적으로 채워지는 케이스에 대한 테스트가 없다면 이번 기회에 추가하는 것도 고려해볼 만합니다.✅ PR Checklist
PR이 다음 요구 사항을 충족하는지 확인하세요.