From e123bab1989576ce29a5503e6f3e95e8c06fdb3c Mon Sep 17 00:00:00 2001 From: Gary Gregory Date: Sun, 15 Nov 2020 10:55:53 -0500 Subject: [PATCH] Fix potential NPE in TypeUtils.isAssignable(Type, ParameterizedType, Map, Type>). --- src/changes/changes.xml | 2 ++ src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 129638d74..300ee63bc 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -57,6 +57,8 @@ The type attribute can be add,update,fix,remove. Remove redundant argument from substring call. BigDecimal is created when you pass it the min and max values, #642. ArrayUtils.contains() and indexOf() fails to handle Double.NaN #647. + Fix potential NPE in TypeUtils.isAssignable(Type, ParameterizedType, Map, Type>). + Add BooleanUtils.booleanValues(). Add BooleanUtils.primitiveValues(). diff --git a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java index 7d904213b..c28d3bdb1 100644 --- a/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java +++ b/src/main/java/org/apache/commons/lang3/reflect/TypeUtils.java @@ -1221,7 +1221,7 @@ public class TypeUtils { // parameters must either be absent from the subject type, within // the bounds of the wildcard type, or be an exact match to the // parameters of the target type. - if (fromTypeArg != null + if (fromTypeArg != null && toTypeArg != null && !toTypeArg.equals(fromTypeArg) && !(toTypeArg instanceof WildcardType && isAssignable(fromTypeArg, toTypeArg, typeVarAssigns))) {