Skip to content
This repository was archived by the owner on May 21, 2026. It is now read-only.

Commit 21b11db

Browse files
Improve exception handling in JwtTokenServiceImpl
Co-authored-by: vitorhugo1207 <65777252+vitorhugo1207@users.noreply.github.com>
1 parent b452946 commit 21b11db

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/main/java/com/espacogeek/geek/services/impl/JwtTokenServiceImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,9 @@ private LocalDateTime extractExpiration(String token) {
120120
return Instant.ofEpochMilli(expiration.getTime())
121121
.atZone(ZoneId.systemDefault())
122122
.toLocalDateTime();
123-
} catch (Exception e) {
124-
// If we can't parse the token, set a default expiration
123+
} catch (io.jsonwebtoken.JwtException e) {
124+
// If we can't parse the token, set a default expiration (7 days from now)
125+
// This should only happen if token format is invalid
125126
return LocalDateTime.now().plusDays(7);
126127
}
127128
}

0 commit comments

Comments
 (0)