NPE in SlingServletResolver (script == null accessed)
-----------------------------------------------------

                 Key: SLING-390
                 URL: https://issues.apache.org/jira/browse/SLING-390
             Project: Sling
          Issue Type: Bug
          Components: ServletResolver
            Reporter: Alexander Klimetschek
            Priority: Critical


This warning popped up after I imported the trunk into Eclipse; it's in 
SlingServletResolver.findScript() at line 225 ff:

                SlingScript script = resource.adaptTo(SlingScript.class);
                if (script == null) {
                    log.debug("findScript: Using script {} for {}",
                        script.getScriptResource().getPath(), name);
                    return script;
                }

Inside the if block, script will be null, thus script.getScriptResource() will 
fail with an NPE and also returning script seems wrong here.

I assume the condition should be if (script != null) instead.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to