You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Yang Lei (JIRA)" <tu...@ws.apache.org> on 2007/09/04 18:30:44 UTC

[jira] Commented: (TUSCANY-1636) There should not be an SCABinding created under reference if there is no target on the reference 558780

    [ https://issues.apache.org/jira/browse/TUSCANY-1636?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12524781 ] 

Yang Lei commented on TUSCANY-1636:
-----------------------------------

As this SCABinding is created for a component reference by Tuscany, the bindingProvider is invoked always. Even if SCABinding provider can implement by checking if there is target or not and return null object, Tuscany will use the result of the bindingProvider invoke to inject a value to the component's reference.  I thought the correct logic is , if we do not declare a component reference, the component's implementation should be able to keep the default value in the component implementation for that reference, instead of getting the value override with a null object.

> There should not be an SCABinding created under reference if there is no target on the reference 558780
> -------------------------------------------------------------------------------------------------------
>
>                 Key: TUSCANY-1636
>                 URL: https://issues.apache.org/jira/browse/TUSCANY-1636
>             Project: Tuscany
>          Issue Type: Bug
>          Components: Java SCA Assembly Model
>            Reporter: Yang Lei
>             Fix For: Java-SCA-Next
>
>
> In CompositeBuilderImpl, we create defeault SCABinding where there is no binding defined under reference. This will break the SCABinding handling if the reference does not have a target, then SCABinding willl still get executed so either there is a NPE as we are not expecting target is not there, or there is a null object set to the reference, which will override existing reference value in the component. 
> I did the following to remove the SCABinding at the end of the CompositeBuilderImpl.connectComponentReferences, the else block
>             if (!targets.isEmpty()) {
>                       ....
>             }else
>             {
>                 // need to remove the SCABinding we created that did not have target
>                 if (componentReference.getBindings().size()==1)
>                 {
>                     SCABinding binding = componentReference.getBinding(SCABinding.class);
>                     if (binding!=null && binding.getURI()==null)
>                     {
>                         componentReference.getBindings().clear();
>                     }
>                 }
>             }
>         }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-dev-help@ws.apache.org