Rupert Westenthaler created STANBOL-1413:
--------------------------------------------

             Summary: NPE in Freemaker BundleTemplateLoader
                 Key: STANBOL-1413
                 URL: https://issues.apache.org/jira/browse/STANBOL-1413
             Project: Stanbol
          Issue Type: Bug
          Components: Commons
    Affects Versions: 0.12.0
            Reporter: Rupert Westenthaler
            Assignee: Rupert Westenthaler
            Priority: Minor
             Fix For: 1.0.0, 0.12.1


I very rare cases the Freemaker BundleTemplate loader is getting NPE when 
loading resources from bundles.

{code}
    java.lang.NullPointerException
                    at 
org.apache.felix.framework.BundleRevisionImpl.getResourceLocal(BundleRevisionImpl.java:495)
                    at 
org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1472)
                    at 
org.apache.felix.framework.BundleWiringImpl.getResourceByDelegation(BundleWiringImpl.java:1400)
                    at 
org.apache.felix.framework.Felix.getBundleResource(Felix.java:1600)
                    at 
org.apache.felix.framework.BundleImpl.getResource(BundleImpl.java:639)
                    at 
org.apache.stanbol.commons.freemarker.impl.BundleTemplateLoader.containsTemplates(BundleTemplateLoader.java:117)
{code}

This NPE happens when trying to load the resource `templates/` via 
{{Bundle.getResource(..)}}. Even if it appears it does only affect few of the 
installed bundles.

As the call is only used to check if the folder `templates/` is available in a 
bundle an exception MUST NOT break the whole BundleTemplateLoader 
initialization. Because of that the code needs to be changed to catch this NPE 
and log it on WARN level. 



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to