Andrei Dulvac created SLING-6978:
------------------------------------

             Summary: [HApi] NPE if type is fetched from cache before the end 
of initialization
                 Key: SLING-6978
                 URL: https://issues.apache.org/jira/browse/SLING-6978
             Project: Sling
          Issue Type: Bug
          Components: HApi
    Affects Versions: HApi 1.0.0
            Reporter: Andrei Dulvac
             Fix For: HApi 1.0.2


An NPE can occur when accessing the type properties from a type before it was 
fully initialized.
{code}
org.apache.sling.hapi.sightly.HApiUse Failed to activate Use class
java.lang.NullPointerException: null
        at java.util.HashMap.putMapEntries(HashMap.java:500)
        at java.util.HashMap.putAll(HashMap.java:784)
        at 
org.apache.sling.hapi.impl.HApiTypeImpl.getAllProperties(HApiTypeImpl.java:141)
        at 
org.apache.sling.hapi.impl.MicrodataAttributeHelperImpl.itemtypeMap(MicrodataAttributeHelperImpl.java:63)
        at org.apache.sling.hapi.sightly.HApiUse.activate(HApiUse.java:81)
        at org.apache.sling.hapi.sightly.HApiUse.init(HApiUse.java:68)
        at 
org.apache.sling.scripting.sightly.impl.engine.extension.use.JavaUseProvider.provide(JavaUseProvider.java:122)
        at 
org.apache.sling.scripting.sightly.impl.engine.extension.use.UseRuntimeExtension.call(UseRuntimeExtension.java:72)
        at 
org.apache.sling.scripting.sightly.impl.engine.runtime.RenderContextImpl.call(RenderContextImpl.java:75)

{code}

The type is inserted in the cache too soon: 
https://github.com/apache/sling/blob/trunk/contrib/extensions/hapi/core/src/main/java/org/apache/sling/hapi/impl/HApiUtilImpl.java#L224



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to