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-bcel.git

commit 5b975983d329cfff727f550e4beadf3a854d8902
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Mon Apr 1 11:08:21 2024 -0400

    Avoid NullPointerException after calling
    org.apache.bcel.classfile.BootstrapMethod.BootstrapMethod(int, int[])
    with null
    
    Avoid NullPointerException after calling
    org.apache.bcel.classfile.BootstrapMethod.setBootstrapArguments(int[])
    with null.
---
 src/changes/changes.xml                                      | 4 +++-
 src/main/java/org/apache/bcel/classfile/BootstrapMethod.java | 5 +++--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 68926332..98fbda75 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -83,7 +83,9 @@ The <action> type attribute can be add,update,fix,remove.
       <action                  type="update" dev="ggregory" due-to="Gary 
Gregory">Avoid NullPointerException after calling 
org.apache.bcel.classfile.ConstantPool.setConstantPool(Constant[]) with 
null.</action>
       <action                  type="update" dev="ggregory" due-to="Gary 
Gregory">Avoid NullPointerException after calling 
org.apache.bcel.classfile.FieldOrMethod.setAttributes(Attribute[]) with 
null.</action>
       <action                  type="update" dev="ggregory" due-to="Gary 
Gregory">Avoid NullPointerException after calling 
org.apache.bcel.classfile.Annotations.setAnnotationTable(AnnotationEntry[]) 
with null.</action>
-      <action                  type="update" dev="ggregory" due-to="Gary 
Gregory">Avoid NullPointerException after 
callingorg.apache.bcel.classfile.ArrayElementValue.ArrayElementValue(int, 
ElementValue[], ConstantPool) with null.</action>
+      <action                  type="update" dev="ggregory" due-to="Gary 
Gregory">Avoid NullPointerException after calling 
org.apache.bcel.classfile.ArrayElementValue.ArrayElementValue(int, 
ElementValue[], ConstantPool) with null.</action>
+      <action                  type="update" dev="ggregory" due-to="Gary 
Gregory">Avoid NullPointerException after calling 
org.apache.bcel.classfile.BootstrapMethod.BootstrapMethod(int, int[]) with 
null.</action>
+      <action                  type="update" dev="ggregory" due-to="Gary 
Gregory">Avoid NullPointerException after calling 
org.apache.bcel.classfile.BootstrapMethod.setBootstrapArguments(int[]) with 
null.</action>
       <!-- UPDATE -->
       <action                  type="update" dev="ggregory" 
due-to="Dependabot">Bump org.apache.commons:commons-parent from 66 to 67 
#283.</action>
       <action                  type="update" dev="ggregory" 
due-to="Dependabot">Bump org.jetbrains.kotlin:kotlin-stdlib from 1.9.22 to 
1.9.23 #284.</action>
diff --git a/src/main/java/org/apache/bcel/classfile/BootstrapMethod.java 
b/src/main/java/org/apache/bcel/classfile/BootstrapMethod.java
index 5f2ec3dc..ad88aa1e 100644
--- a/src/main/java/org/apache/bcel/classfile/BootstrapMethod.java
+++ b/src/main/java/org/apache/bcel/classfile/BootstrapMethod.java
@@ -23,6 +23,7 @@ import java.io.IOException;
 import java.util.Arrays;
 
 import org.apache.bcel.Const;
+import org.apache.commons.lang3.ArrayUtils;
 
 /**
  * This class represents a bootstrap method attribute, i.e., the bootstrap 
method ref, the number of bootstrap arguments
@@ -74,7 +75,7 @@ public class BootstrapMethod implements Cloneable {
      */
     public BootstrapMethod(final int bootstrapMethodRef, final int[] 
bootstrapArguments) {
         this.bootstrapMethodRef = bootstrapMethodRef;
-        this.bootstrapArguments = bootstrapArguments;
+        setBootstrapArguments(bootstrapArguments);
     }
 
     /**
@@ -128,7 +129,7 @@ public class BootstrapMethod implements Cloneable {
      * @param bootstrapArguments int[] indices into constant_pool of 
CONSTANT_[type]_info
      */
     public void setBootstrapArguments(final int[] bootstrapArguments) {
-        this.bootstrapArguments = bootstrapArguments;
+        this.bootstrapArguments = ArrayUtils.nullToEmpty(bootstrapArguments);
     }
 
     /**

Reply via email to