sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Seifert (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (SLING-7204) OSGi R6 annotations: default value of an empty array is propagated as null
Date Tue, 31 Jul 2018 11:17:00 GMT

     [ https://issues.apache.org/jira/browse/SLING-7204?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Stefan Seifert resolved SLING-7204.
-----------------------------------
    Resolution: Won't Fix

yes

> 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
>            Priority: Major
>
> 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
(v7.6.3#76005)

Mime
View raw message