From ac63d81d15d9eff7761b063ace70aee2c7312518 Mon Sep 17 00:00:00 2001 From: tmdtmdqorekf Date: Thu, 23 May 2024 05:02:02 +0900 Subject: [PATCH] =?UTF-8?q?[fix]=20=EB=B3=B4=EB=82=B8=20=EB=A7=A4=EC=B9=AD?= =?UTF-8?q?=20=EC=9A=94=EC=B2=AD=20=EC=A0=95=EB=B3=B4=20500=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../backend/domain/match/service/MatchService.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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; + } } // 매칭 요청 검증