diff --git a/backend/src/main/java/com/coffee/backend/domain/match/service/MatchService.java b/backend/src/main/java/com/coffee/backend/domain/match/service/MatchService.java index e874bd3a0c..44b1cf5bee 100644 --- a/backend/src/main/java/com/coffee/backend/domain/match/service/MatchService.java +++ b/backend/src/main/java/com/coffee/backend/domain/match/service/MatchService.java @@ -116,6 +116,10 @@ public MatchInfoResponseDto getMatchRequestInfo(Long senderId) { throw new CustomException(ErrorCode.REQUEST_NOT_FOUND); } + if (keys == null || keys.isEmpty()) { + throw new CustomException(ErrorCode.REQUEST_NOT_FOUND); + } + MatchInfoResponseDto response = new MatchInfoResponseDto(); for (String key : keys) { Map matchInfo; @@ -136,6 +140,7 @@ public MatchInfoResponseDto getMatchRequestInfo(Long senderId) { response = mapper.map(matchInfo, MatchInfoResponseDto.class); response.setReceiverInfo(receiverInfo); + break; } else { throw new CustomException(ErrorCode.REQUEST_NOT_FOUND); } @@ -331,7 +336,13 @@ private void validateUser(MatchRequestDto dto) { } private boolean hasNotExpired(String expirationTime) { - return System.currentTimeMillis() < Long.parseLong(expirationTime); + try { + long expirationMillis = Long.parseLong(expirationTime); + return System.currentTimeMillis() < expirationMillis; + } catch (NumberFormatException e) { + log.error("Invalid expiration time format: {}", expirationTime, e); + return false; + } } // 매칭 요청 검증