@@ -168,7 +168,7 @@ public Verification withArrayClaim(String name, Integer... items) throws Illegal
168168 requireClaim (name , items );
169169 return this ;
170170 }
171-
171+
172172 /**
173173 * Require a specific Array Claim to contain at least the given items.
174174 *
@@ -178,11 +178,11 @@ public Verification withArrayClaim(String name, Integer... items) throws Illegal
178178 * @throws IllegalArgumentException if the name is null.
179179 */
180180 @ Override
181- public Verification withArrayClaim (String name , Long ... items ) throws IllegalArgumentException {
181+ public Verification withArrayClaim (String name , Long ... items ) throws IllegalArgumentException {
182182 assertNonNull (name );
183183 requireClaim (name , items );
184184 return this ;
185- }
185+ }
186186
187187 @ Override
188188 public JWTVerifier build () {
@@ -220,7 +220,7 @@ private void addLeewayToDateClaims() {
220220 if (!claims .containsKey (PublicClaims .NOT_BEFORE )) {
221221 claims .put (PublicClaims .NOT_BEFORE , defaultLeeway );
222222 }
223- if (ignoreIssuedAt ) {
223+ if (ignoreIssuedAt ) {
224224 claims .remove (PublicClaims .ISSUED_AT );
225225 return ;
226226 }
@@ -329,18 +329,18 @@ private void assertValidClaim(Claim claim, String claimName, Object value) {
329329 Object [] claimAsObject = claim .as (Object [].class );
330330
331331 // Jackson uses 'natural' mapping which uses Integer if value fits in 32 bits.
332- if (value instanceof Long []) {
332+ if (value instanceof Long []) {
333333 // convert Integers to Longs for comparison with equals
334334 claimArr = new ArrayList <>(claimAsObject .length );
335- for (Object cao : claimAsObject ) {
336- if (cao instanceof Integer ) {
337- claimArr .add (((Integer )cao ).longValue ());
335+ for (Object cao : claimAsObject ) {
336+ if (cao instanceof Integer ) {
337+ claimArr .add (((Integer ) cao ).longValue ());
338338 } else {
339339 claimArr .add (cao );
340340 }
341341 }
342342 } else {
343- claimArr = Arrays .asList (claim .as (Object [].class ));
343+ claimArr = claim . isNull () ? Collections . emptyList () : Arrays .asList (claim .as (Object [].class ));
344344 }
345345 List <Object > valueArr = Arrays .asList ((Object []) value );
346346 isValid = claimArr .containsAll (valueArr );
0 commit comments