Laurie byrum created SLING-4287:
-----------------------------------

             Summary: Cannot activate agent factory in osgi console
                 Key: SLING-4287
                 URL: https://issues.apache.org/jira/browse/SLING-4287
             Project: Sling
          Issue Type: Bug
          Components: Distribution
            Reporter: Laurie byrum


A NPE occurs if you start with a disabled SyncDistributionAgentFactory and 
later enable it in the felix OSGi configmgr. It happens at
https://github.com/apache/sling/blob/cf076879f572d9976fd002d67e48108af5992eaa/contrib/extensions/distribution/core/src/main/java/org/apache/sling/distribution/agent/impl/SyncDistributionAgentFactory.java#l162

Here is a partial stack trace:
06.01.2015 16:34:33.950 *ERROR* [CM Event Dispatcher (Fire ConfigurationEvent: 
pid=org.apache.sling.distribution.agent.impl.SyncDistributionAgentFactory.810b0979-8c7c-4fe6-aa47-6ddf430485e0)]
 org.apache.sling.distribution.core 
[org.apache.sling.distribution.agent.impl.SyncDistributionAgentFactory(141)] 
The activate method has thrown an exception (java.lang.NullPointerException)
java.lang.NullPointerException: null
        at java.util.Hashtable.put(Hashtable.java:514)
        at 
org.apache.sling.distribution.agent.impl.SyncDistributionAgentFactory.activate(SyncDistributionAgentFactory.java:161)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


This is because config.get(DistributionConstants.PN_IS_RESOURCE) is always 
returning null if you edit via the osgi config. I worked around this locally by 
having a default value for isResource.



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

Reply via email to