Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Not A Problem
-
scr-2.1.8, scr-2.1.26
-
None
-
None
Description
OSGi-Spec:
If the constructor parameter is associated with a reference having cardinality of 0..1 and there is no bound service for the reference, then the value null will be supplied as the constructor parameter.
{{}}
when trying with Felix-SCR i got this Exception:
{{}}
java.lang.InstantiationException: Unable to get service for reference optionalNull
at org.apache.felix.scr.impl.inject.internal.ComponentConstructorImpl.newInstance(ComponentConstructorImpl.java:301)
at org.apache.felix.scr.impl.manager.SingleComponentManager.createImplementationObject(SingleComponentManager.java:279)
at org.apache.felix.scr.impl.manager.SingleComponentManager.createComponent(SingleComponentManager.java:115)
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:984)
at org.apache.felix.scr.impl.manager.SingleComponentManager.getServiceInternal(SingleComponentManager.java:957)
at org.apache.felix.scr.impl.manager.SingleComponentManager.getService(SingleComponentManager.java:902)
at o
You can test it with this test in the PR to the ds-tck:
[https://github.com/osgi/osgi/pull/230
]{{}}