From 19740695616b827f484a96344757fb07eee0db5c Mon Sep 17 00:00:00 2001 From: Les Hazlewood Date: Sun, 11 Sep 2016 14:04:20 -0700 Subject: [PATCH] 107: ensured exception message printed UTC times correctly --- src/main/java/io/jsonwebtoken/impl/DefaultJwtParser.java | 2 +- src/test/groovy/io/jsonwebtoken/JwtParserTest.groovy | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/jsonwebtoken/impl/DefaultJwtParser.java b/src/main/java/io/jsonwebtoken/impl/DefaultJwtParser.java index 50df0c7ed..90e9923a5 100644 --- a/src/main/java/io/jsonwebtoken/impl/DefaultJwtParser.java +++ b/src/main/java/io/jsonwebtoken/impl/DefaultJwtParser.java @@ -56,7 +56,7 @@ public class DefaultJwtParser implements JwtParser { //don't need millis since JWT date fields are only second granularity: - private static final String ISO_8601_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZ"; + private static final String ISO_8601_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'"; private ObjectMapper objectMapper = new ObjectMapper(); diff --git a/src/test/groovy/io/jsonwebtoken/JwtParserTest.groovy b/src/test/groovy/io/jsonwebtoken/JwtParserTest.groovy index 528656dc3..5884e9a93 100644 --- a/src/test/groovy/io/jsonwebtoken/JwtParserTest.groovy +++ b/src/test/groovy/io/jsonwebtoken/JwtParserTest.groovy @@ -175,6 +175,9 @@ class JwtParserTest { fail() } catch (ExpiredJwtException e) { assertTrue e.getMessage().startsWith('JWT expired at ') + + //https://github.com/jwtk/jjwt/issues/107 : + assertTrue e.getMessage().endsWith('Z') } } @@ -190,6 +193,9 @@ class JwtParserTest { fail() } catch (PrematureJwtException e) { assertTrue e.getMessage().startsWith('JWT must not be accepted before ') + + //https://github.com/jwtk/jjwt/issues/107 : + assertTrue e.getMessage().endsWith('Z') } }