You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:23:03 UTC

[sling-org-apache-sling-commons-osgi] 03/38: Prevent NPE if the property value is null in toStringArray

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

rombert pushed a commit to annotated tag org.apache.sling.commons.osgi-2.0.2-incubator
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-commons-osgi.git

commit 8b99d1f6173603a922a884aee476e78d57573239
Author: Felix Meschberger <fm...@apache.org>
AuthorDate: Tue Jan 15 12:29:31 2008 +0000

    Prevent NPE if the property value is null in toStringArray
    
    git-svn-id: https://svn.apache.org/repos/asf/incubator/sling/whiteboard/fmeschbe/resource/osgi/commons@612094 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java b/src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java
index 724accd..705b960 100644
--- a/src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java
+++ b/src/main/java/org/apache/sling/osgi/commons/OsgiUtil.java
@@ -137,7 +137,11 @@ public class OsgiUtil {
      * returned.
      */
     public static String[] toStringArray(Object propValue) {
-        if (propValue instanceof String) {
+        if (propValue == null) {
+            // no value at all
+            return null;
+            
+        } else if (propValue instanceof String) {
             // single string
             return new String[] { (String) propValue };
 

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.