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

Raymond Feng commented on TUSCANY-1636:
---------------------------------------

Adding a SCABinding if there is no explicit bindings conforms to the SCA 
assembly spec.  There might be different cases where the target is not present, 
for exaample, the multiplicity is 0..1 or 0..N, or wiredByImpl = true. 

I agree we need to have a better exception than NPE, but removing the SCA 
binding maybe is not the correct fix :-). 

> 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
>
> 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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to