You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/11/15 15:55:57 UTC

[commons-lang] branch master updated: Fix potential NPE in TypeUtils.isAssignable(Type, ParameterizedType, Map, Type>).

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-lang.git


The following commit(s) were added to refs/heads/master by this push:
     new e123bab  Fix potential NPE in TypeUtils.isAssignable(Type, ParameterizedType, Map, Type>).
e123bab is described below

commit e123bab1989576ce29a5503e6f3e95e8c06fdb3c
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun Nov 15 10:55:53 2020 -0500

    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 129638d..300ee63 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -57,6 +57,8 @@ The <action> type attribute can be add,update,fix,remove.
     <action issue="LANG-1591" type="update" dev="kinow" due-to="bhawna94">Remove redundant argument from substring call.</action>
     <action issue="LANG-1613" type="update" dev="ggregory" due-to="Arturo Bernal, Gary Gregory">BigDecimal is created when you pass it the min and max values, #642.</action>
     <action issue="LANG-1541" type="update" dev="ggregory" due-to="Arturo Bernal, Gary Gregory">ArrayUtils.contains() and indexOf() fails to handle Double.NaN #647.</action>
+    <action issue="LANG-1541" type="update" dev="ggregory" due-to="Gary Gregory">Fix potential NPE in TypeUtils.isAssignable(Type, ParameterizedType, Map, Type>).</action>
+    
     <!--  ADDS -->
     <action                   type="add" dev="ggregory" due-to="Gary Gregory">Add BooleanUtils.booleanValues().</action>
     <action                   type="add" dev="ggregory" due-to="Gary Gregory">Add BooleanUtils.primitiveValues().</action>
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 7d90421..c28d3bd 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))) {