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 10:13:54 UTC

[sling-org-apache-sling-security] 03/06: SLING-4982 - NPE in ContentDispositionFilter

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

rombert pushed a commit to annotated tag org.apache.sling.security-1.0.16
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-security.git

commit e9492aa5a1651388dad9c89e57be552449ecd6f8
Author: Antonio Sanso <as...@apache.org>
AuthorDate: Tue Sep 1 09:02:53 2015 +0000

    SLING-4982 - NPE in ContentDispositionFilter
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/security@1700426 13f79535-47bb-0310-9956-ffa450edef68
---
 .../security/impl/ContentDispositionFilter.java    | 28 ++++++++++++----------
 1 file changed, 16 insertions(+), 12 deletions(-)

diff --git a/src/main/java/org/apache/sling/security/impl/ContentDispositionFilter.java b/src/main/java/org/apache/sling/security/impl/ContentDispositionFilter.java
index 96b2df0..34e7871 100644
--- a/src/main/java/org/apache/sling/security/impl/ContentDispositionFilter.java
+++ b/src/main/java/org/apache/sling/security/impl/ContentDispositionFilter.java
@@ -283,19 +283,23 @@ public class ContentDispositionFilter implements Filter {
         
         private boolean isJcrData(Resource resource){
             boolean jcrData = false;
-            if (resource!= null) {
-                ValueMap props = resource.adaptTo(ValueMap.class);
-                if (props != null && props.containsKey(PROP_JCR_DATA) ) {
-                    jcrData = true;
-                } else {
-                    Resource jcrContent = resource.getChild(JCR_CONTENT_LEAF);
-                    if (jcrContent!= null) {
-                        props = jcrContent.adaptTo(ValueMap.class);
-                        if (props != null && props.containsKey(PROP_JCR_DATA) ) {
-                            jcrData = true;
+            try {
+                if (resource!= null) {
+                    ValueMap props = resource.adaptTo(ValueMap.class);
+                    if (props != null && props.containsKey(PROP_JCR_DATA) ) {
+                        jcrData = true;
+                    } else {
+                        Resource jcrContent = resource.getChild(JCR_CONTENT_LEAF);
+                        if (jcrContent!= null) {
+                            props = jcrContent.adaptTo(ValueMap.class);
+                            if (props != null && props.containsKey(PROP_JCR_DATA) ) {
+                                jcrData = true;
+                            }
                         }
-                    }
-                }     
+                    }     
+                }
+            } catch (Exception e) {
+                logger.error("Exception in isJcrData", e);
             }
             return jcrData;
         }

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