Robert Munteanu created SLING-7204:
--------------------------------------

             Summary: OSGi R6 annotations: default value of an empty array is 
propagated as null
                 Key: SLING-7204
                 URL: https://issues.apache.org/jira/browse/SLING-7204
             Project: Sling
          Issue Type: Bug
          Components: Testing
    Affects Versions: Testing OSGi Mock 2.3.4
            Reporter: Robert Munteanu


I'm conferting some of the Oak code to use the OSGi R6 annotations. I have a 
config that declares a String[] property which defaults to empty, along the 
lines of:

{code:java}
@Component(configurationPolicy = ConfigurationPolicy.REQUIRE)
public class CompositeNodeStoreService {

    static @interface Configuration {
        
        /**
         * Writes to these read-only paths won't fail the commit
         */
        String[] ignoreReadOnlyWrites() default {};
    }

    @Activate
    protected void activate(Configuration cfg, ComponentContext context) throws 
IOException, CommitFailedException {
        ignoreReadOnlyWritePaths = cfg.ignoreReadOnlyWrites()
{code}

In a unit test this should default to an empty array, but instead it is null. I 
checked the generated SCR descriptors, and the property is missing. If I add a 
property to the default value, the property appears in the SCR descriptor. 
Maybe a behaviour change in newer revisions of SCR?



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

Reply via email to