[
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)