Skip to content

Commit

Permalink
[fix] 보낸 매칭 요청 정보 500 에러 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
tmdtmdqorekf committed May 22, 2024
1 parent e783531 commit ac63d81
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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<Object, Object> matchInfo;
Expand All @@ -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);
}
Expand Down Expand Up @@ -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;
}
}

// 매칭 요청 검증
Expand Down

0 comments on commit ac63d81

Please sign in to comment.