[ 
https://issues.apache.org/jira/browse/SLING-7204?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16209296#comment-16209296
 ] 

Karl Pauls commented on SLING-7204:
-----------------------------------

[~rombert], this is correct. As [[email protected]] points out 
(indirectly), this is the correct SCR/DS behaviour as mentioned in the spec. 
IIRC, the next version of the spec (DS 1.4) will change this to an empty array 
[0] but for now (with DS 1.2) that is what the spec mandates. 

[0] https://osgi.org/bugzilla/show_bug.cgi?id=208

> 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