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 95552fea8528697b0679f2b0a03e4426304f580d
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Mon Apr 1 11:22:43 2024 -0400

    Avoid NullPointerException calling
    
org.apache.bcel.generic.InstructionList.redirectExceptionHandlers(CodeExceptionGen[],
    InstructionHandle, InstructionHandle) with null
---
 src/changes/changes.xml                                    | 1 +
 src/main/java/org/apache/bcel/generic/InstructionList.java | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index bbf421d3..1ee1e74f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -90,6 +90,7 @@ 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.BootstrapMethods.BootstrapMethods(int, int, 
BootstrapMethod[], ConstantPool) with null.</action>
       <action                  type="update" dev="ggregory" due-to="Gary 
Gregory">Avoid NullPointerException after calling 
org.apache.bcel.classfile.BootstrapMethods.setBootstrapMethods(BootstrapMethod[])
 with null.</action>
       <action                  type="update" dev="ggregory" due-to="Gary 
Gregory">Avoid NullPointerException calling 
org.apache.bcel.generic.InstructionList.redirectLocalVariables(LocalVariableGen[],
 InstructionHandle, InstructionHandle) with null.</action>
+      <action                  type="update" dev="ggregory" due-to="Gary 
Gregory">Avoid NullPointerException calling 
org.apache.bcel.generic.InstructionList.redirectExceptionHandlers(CodeExceptionGen[],
 InstructionHandle, InstructionHandle) 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/generic/InstructionList.java 
b/src/main/java/org/apache/bcel/generic/InstructionList.java
index 2f8c11aa..c840a7e7 100644
--- a/src/main/java/org/apache/bcel/generic/InstructionList.java
+++ b/src/main/java/org/apache/bcel/generic/InstructionList.java
@@ -957,7 +957,7 @@ public class InstructionList implements 
Iterable<InstructionHandle> {
      * @see MethodGen
      */
     public void redirectExceptionHandlers(final CodeExceptionGen[] exceptions, 
final InstructionHandle oldTarget, final InstructionHandle newTarget) {
-        for (final CodeExceptionGen exception : exceptions) {
+        Streams.of(exceptions).forEach(exception -> {
             if (exception.getStartPC() == oldTarget) {
                 exception.setStartPC(newTarget);
             }
@@ -967,7 +967,7 @@ public class InstructionList implements 
Iterable<InstructionHandle> {
             if (exception.getHandlerPC() == oldTarget) {
                 exception.setHandlerPC(newTarget);
             }
-        }
+        });
     }
 
     /**

Reply via email to