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 18690dedd95d99f6602ff361f8550147b98fdc96 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Mon Apr 1 09:06:42 2024 -0400 Avoid possible NullPointerException in AnnotationEntryGen.getAnnotationAttributes(ConstantPoolGen, AnnotationEntryGen[]) --- src/changes/changes.xml | 1 + src/main/java/org/apache/bcel/generic/AnnotationEntryGen.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 58e53dd7..e7472ae4 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -61,6 +61,7 @@ The <action> type attribute can be add,update,fix,remove. <body> <release version="6.8.3" date="YYYY-MM-DD" description="Maintenance and bug fix release."> <action type="update" dev="ggregory" due-to="Gary Gregory">Avoid possible NullPointerException in org.apache.bcel.classfile.DescendingVisitor.accept(E[]).</action> + <action type="update" dev="ggregory" due-to="Gary Gregory">Avoid possible NullPointerException in AnnotationEntryGen.getAnnotationAttributes(ConstantPoolGen, AnnotationEntryGen[]).</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/AnnotationEntryGen.java b/src/main/java/org/apache/bcel/generic/AnnotationEntryGen.java index 603404a2..de0199c0 100644 --- a/src/main/java/org/apache/bcel/generic/AnnotationEntryGen.java +++ b/src/main/java/org/apache/bcel/generic/AnnotationEntryGen.java @@ -33,6 +33,7 @@ import org.apache.bcel.classfile.RuntimeInvisibleAnnotations; import org.apache.bcel.classfile.RuntimeInvisibleParameterAnnotations; import org.apache.bcel.classfile.RuntimeVisibleAnnotations; import org.apache.bcel.classfile.RuntimeVisibleParameterAnnotations; +import org.apache.commons.lang3.ArrayUtils; /** * @since 6.0 @@ -48,7 +49,7 @@ public class AnnotationEntryGen { * @param annotationEntryGens An array of AnnotationGen objects */ static Attribute[] getAnnotationAttributes(final ConstantPoolGen cp, final AnnotationEntryGen[] annotationEntryGens) { - if (annotationEntryGens.length == 0) { + if (ArrayUtils.isEmpty(annotationEntryGens)) { return Attribute.EMPTY_ARRAY; }