aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guillaume Nodet (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (ARIES-1668) Failing to set null value inside property-placeholder
Date Fri, 19 Jan 2018 10:45:00 GMT

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

Guillaume Nodet updated ARIES-1668:
-----------------------------------
    Component/s: Blueprint

> Failing to set null value inside property-placeholder 
> ------------------------------------------------------
>
>                 Key: ARIES-1668
>                 URL: https://issues.apache.org/jira/browse/ARIES-1668
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: 1.0
>            Reporter: Valentin Aitken
>            Assignee: Grzegorz Grzybek
>            Priority: Major
>              Labels: blueprint
>
> *Scenario:*
> For a bean I'd like to supply property-placeholder with a default null value.
> {code:xml}
>     <cm:property-placeholder persistent-id="org.apache.xxx.placeholder">
>         <cm:default-properties>
>             <cm:property name="foo.bar">
>                 <null/>
>             </cm:property>
>         </cm:default-properties>
>     </cm:property-placeholder>
>     <bean class="org.apache.xxx.FooImpl" id="xxx-id">
>         <property name="fooBar" value="${foo.bar}"/>
>     </bean>
> {code}
> {code:java}
> package org.apache.xxx;
> public class FooImpl {
>   public void setFooBar(Integer fooBar) { this.fooBar = fooBar;}
>   public Integer getFooBar() { return fooBar; }
> }
> {code}
> *Observed behaviour:*
> {noformat}
> ERROR  17 o.a.a.b.c.BlueprintContainerImpl [rint Extender: 3] Unable to start blueprint
container for bundle org.apache.xxx/0.x.0.SNAPSHOT
> org.osgi.service.blueprint.container.ComponentDefinitionException: Error setting property:
PropertyDescriptor <name: maxAge, getter: class org.apache.xxx.FooImpl.getFooBar(), setter:
[class org.apache.xxx.FooImpl.setFooBar(class java.lang.Integer)]
>   at org.apache.aries.blueprint.container.BeanRecipe.setProperty(BeanRecipe.java:963)[17:org.apache.aries.blueprint.core:1.5.0]
>   at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:929)[17:org.apache.aries.blueprint.core:1.5.0]
>   at org.apache.aries.blueprint.container.BeanRecipe.setProperties(BeanRecipe.java:910)[17:org.apache.aries.blueprint.core:1.5.0]
>   at org.apache.aries.blueprint.container.BeanRecipe.internalCreate2(BeanRecipe.java:844)[17:org.apache.aries.blueprint.core:1.5.0]
>   at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:811)[17:org.apache.aries.blueprint.core:1.5.0]
>   at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:79)[17:org.apache.aries.blueprint.core:1.5.0]
>   at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_111]
>   at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:88)[17:org.apache.aries.blueprint.core:1.5.0]
>   at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:255)[17:org.apache.aries.blueprint.core:1.5.0]
>   at org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:186)[17:org.apache.aries.blueprint.core:1.5.0]
>   at org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:712)[17:org.apache.aries.blueprint.core:1.5.0]
>   at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:399)[17:org.apache.aries.blueprint.core:1.5.0]
>   at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:273)[17:org.apache.aries.blueprint.core:1.5.0]
>   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_111]
>   at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_111]
>   at org.apache.aries.blueprint.container.ExecutorServiceWrapper.run(ExecutorServiceWrapper.java:106)[17:org.apache.aries.blueprint.core:1.5.0]
>   at org.apache.aries.blueprint.utils.threading.impl.DiscardableRunnable.run(DiscardableRunnable.java:48)[17:org.apache.aries.blueprint.core:1.5.0]
>   at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_111]
>   at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_111]
>   at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_111]
>   at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.8.0_111]
>   at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_111]
>   at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_111]
>   at java.lang.Thread.run(Thread.java:745)[:1.8.0_111]
> Caused by: java.lang.NumberFormatException: For input string: ""
>   at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)[:1.8.0_111]
> {noformat}
> Versions loaded in karaf
> {noformat}
>  | mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.api/1.0.1
>  | mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.cm/1.0.7
>  | mvn:org.apache.aries.blueprint/org.apache.aries.blueprint.core/1.5.0
> {noformat}
> *My Analysis:*
> I discovered that org.osgi.service.blueprint.reflect.Metadata.NullMetadata.NULL set correctly
on to the BeanProperty
> However good work from {{context.parseElement(BeanProperty.class, enclosingComponent,
e)}} is being vanished from [props.addEntry(createValue(context, prop.getName(), String.class.getName()),
prop.getValue());|https://github.com/apache/aries/blob/trunk/blueprint/blueprint-cm/src/main/java/org/apache/aries/blueprint/compendium/cm/CmNamespaceHandler.java#L370]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message