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 2023/03/25 21:35:18 UTC

[commons-configuration] 01/12: Avoid NullPointerException in org.apache.commons.configuration2.web.AppletConfiguration.getKeysInternal().

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

commit 4f496190eaf6e629e70dcb0cdd38fd6a62758517
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Mar 25 16:47:05 2023 -0400

    Avoid NullPointerException in
    org.apache.commons.configuration2.web.AppletConfiguration.getKeysInternal().
---
 src/changes/changes.xml                                            | 5 ++++-
 .../org/apache/commons/configuration2/web/AppletConfiguration.java | 7 ++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 65040e1a..f329fd05 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -36,7 +36,7 @@
       </action>
       <action type="fix" dev="ggregory" due-to="Arturo Bernal">
         Use Java style array decelerations #244.
-      </action>
+      </action>org.apache.commons.configuration2.web.AppletConfiguration.getKeysInternal()
       <!-- ADD -->
       <action issue="CONFIGURATION-799" type="add" dev="ggregory" due-to="Xinshiyou, Gary Gregory">
         Add DefaultConversionHandler#setListDelimiterHandler(ListDelimiterHandler).
@@ -44,6 +44,9 @@
       <action type="fix" dev="ggregory" due-to="Gary Gregory">
         Add ImmutableNode.stream().
       </action>
+      <action type="fix" dev="ggregory" due-to="Gary Gregory">
+        Avoid NullPointerException in org.apache.commons.configuration2.web.AppletConfiguration.getKeysInternal().
+      </action>
       <!-- UPDATE -->
       <action type="update" dev="ggregory" due-to="Gary Gregory, Dependabot">
         Bump actions/checkout from 3 to 3.1.0 #224.
diff --git a/src/main/java/org/apache/commons/configuration2/web/AppletConfiguration.java b/src/main/java/org/apache/commons/configuration2/web/AppletConfiguration.java
index 13d15a73..511bb646 100644
--- a/src/main/java/org/apache/commons/configuration2/web/AppletConfiguration.java
+++ b/src/main/java/org/apache/commons/configuration2/web/AppletConfiguration.java
@@ -49,10 +49,11 @@ public class AppletConfiguration extends BaseWebConfiguration {
     protected Iterator<String> getKeysInternal() {
         final String[][] paramsInfo = applet.getParameterInfo();
         final String[] keys = new String[paramsInfo != null ? paramsInfo.length : 0];
-        for (int i = 0; i < keys.length; i++) {
-            keys[i] = paramsInfo[i][0];
+        if (paramsInfo != null) {
+            for (int i = 0; i < keys.length; i++) {
+                keys[i] = paramsInfo[i][0];
+            }
         }
-
         return Arrays.asList(keys).iterator();
     }
 }