You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tuscany.apache.org by "Julien Bigot (JIRA)" <de...@tuscany.apache.org> on 2009/04/21 17:57:47 UTC
[jira] Created: (TUSCANY-2982) Problem when more than one component
has the same implementation.composite and that this composite has exposed
references
Problem when more than one component has the same implementation.composite and that this composite has exposed references
-------------------------------------------------------------------------------------------------------------------------
Key: TUSCANY-2982
URL: https://issues.apache.org/jira/browse/TUSCANY-2982
Project: Tuscany
Issue Type: Bug
Components: Java SCA Assembly Model
Affects Versions: Java-SCA-1.4
Environment: Linux / JavaSE-1.6
Reporter: Julien Bigot
When in a hierarchy of instantiated components, two components (even not at the same level of the hierarchy) have the same implementation.composite and that the referenced composite has a reference promoting one (or more) reference of its internal components, connecting these composite references leads to a NullPointerException.
For example:
A.componentType
|-> reference refA
|-> service servA
B.composite
|-> component a: A
|-> reference refB = a/refA
C.composite
|-> component b: B
|-> reference refC = b/refB
D.composite
|-> component a: A
|-> component b: B
|-> component c: C
|-> wire a/servA <-> b/refB
|-> wire a/servA <-> c/refC
instantiation of D leads to the following hierarchy
D/
|->a
|->b/
|->a
|->c/
|->b/
|->a
There are two instances of B (D/b & D/c/b) and these two instances have a reference (refB) promoting a reference of an internal component (a/refA), this results in the following NullPointerException :
java.lang.NullPointerException
at org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl.checkCompatibility(InterfaceContractMapperImpl.java:155)
at org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl.isCompatible(InterfaceContractMapperImpl.java:271)
at org.apache.tuscany.sca.assembly.builder.impl.BaseWireBuilderImpl.connectWires(BaseWireBuilderImpl.java:940)
at org.apache.tuscany.sca.assembly.builder.impl.BaseWireBuilderImpl.wireComponentReferences(BaseWireBuilderImpl.java:112)
from my initial investigations, this seems somehow related to the fact that when cloned, CompositeReferenceImpl's do not clone their promotedReferences attribute, but rather copy it. I didn't manage to get further however.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
Re: [jira] Commented: (TUSCANY-2982) Problem when more than one component has the same implementation.composite and that this composite has exposed references
Posted by Raymond Feng <en...@gmail.com>.
Thanks for the patch.
The fix to the clone() is good. We'll have to investigate a bit more to
understand if the clone of the composite happens before other builders. If
the clone is done after the reconciliations of the composite, then the clone
of the composite will have to re-link some of the pieces, for example, the
promotedReference will have to be replaced by the "cloned" component
reference.
Can you also attach the test case in the JIRA so that it can be used to
validate the fix?
Raymond
--------------------------------------------------
From: "Julien Bigot (JIRA)" <de...@tuscany.apache.org>
Sent: Tuesday, April 21, 2009 10:58 AM
To: <de...@tuscany.apache.org>
Subject: [jira] Commented: (TUSCANY-2982) Problem when more than one
component has the same implementation.composite and that this composite has
exposed references
>
> [
> https://issues.apache.org/jira/browse/TUSCANY-2982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12701219#action_12701219 ]
>
> Julien Bigot commented on TUSCANY-2982:
> ---------------------------------------
>
> The following two patches seems to resolve the issue, however I do not
> know how dirty the hack it is.
>
> ---
> modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java.old
> 2008-12-02 14:02:19.000000000 +0100
> +++
> modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java
> 2009-04-21 19:34:23.000000000 +0200
> @@ -920,15 +920,9 @@
>
> // Resolve the target service
> ComponentService target = wire.getTarget();
> - if (target != null && target.isUnresolved()) {
> - resolvedService = componentServices.get(target.getName());
> - if (resolvedService != null) {
> - wire.setTarget(target);
> - } else {
> - warning("WireTargetNotFound", composite, source.getName());
> - }
> - } else {
> - resolvedService = wire.getTarget();
> + resolvedService = componentServices.get(target.getName());
> + if (resolvedService == null) {
> + warning("WireTargetNotFound", composite, source.getName());
> }
>
> // Add the target service to the list of targets of the
>
> ---
> modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java.old
> 2008-12-02 14:02:18.000000000 +0100
> +++
> modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java
> 2009-04-21 19:09:44.000000000 +0200
> @@ -41,7 +41,12 @@
>
> @Override
> public Object clone() throws CloneNotSupportedException {
> - return super.clone();
> + CompositeReferenceImpl result = (CompositeReferenceImpl) super.clone();
> + result.promotedReferences = new ArrayList<ComponentReference>();
> + for (ComponentReference promotedReference: promotedReferences) {
> +
> result.promotedReferences.add((ComponentReference)promotedReference.clone());
> + }
> + return result;
> }
>
> public List<ComponentReference> getPromotedReferences() {
>
>> Problem when more than one component has the same
>> implementation.composite and that this composite has exposed references
>> -------------------------------------------------------------------------------------------------------------------------
>>
>> Key: TUSCANY-2982
>> URL: https://issues.apache.org/jira/browse/TUSCANY-2982
>> Project: Tuscany
>> Issue Type: Bug
>> Components: Java SCA Assembly Model
>> Affects Versions: Java-SCA-1.4
>> Environment: Linux / JavaSE-1.6
>> Reporter: Julien Bigot
>>
>> When in a hierarchy of instantiated components, two components (even not
>> at the same level of the hierarchy) have the same
>> implementation.composite and that the referenced composite has a
>> reference promoting one (or more) reference of its internal components,
>> connecting these composite references leads to a NullPointerException.
>> For example:
>> A.componentType
>> |-> reference refA
>> |-> service servA
>> B.composite
>> |-> component a: A
>> |-> reference refB = a/refA
>> C.composite
>> |-> component b: B
>> |-> reference refC = b/refB
>> D.composite
>> |-> component a: A
>> |-> component b: B
>> |-> component c: C
>> |-> wire a/servA <-> b/refB
>> |-> wire a/servA <-> c/refC
>> instantiation of D leads to the following hierarchy
>> D/
>> |->a
>> |->b/
>> |->a
>> |->c/
>> |->b/
>> |->a
>> There are two instances of B (D/b & D/c/b) and these two instances have a
>> reference (refB) promoting a reference of an internal component (a/refA),
>> this results in the following NullPointerException :
>> java.lang.NullPointerException
>> at
>> org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl.checkCompatibility(InterfaceContractMapperImpl.java:155)
>> at
>> org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl.isCompatible(InterfaceContractMapperImpl.java:271)
>> at
>> org.apache.tuscany.sca.assembly.builder.impl.BaseWireBuilderImpl.connectWires(BaseWireBuilderImpl.java:940)
>> at
>> org.apache.tuscany.sca.assembly.builder.impl.BaseWireBuilderImpl.wireComponentReferences(BaseWireBuilderImpl.java:112)
>> from my initial investigations, this seems somehow related to the fact
>> that when cloned, CompositeReferenceImpl's do not clone their
>> promotedReferences attribute, but rather copy it. I didn't manage to get
>> further however.
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
[jira] Commented: (TUSCANY-2982) Problem when more than one
component has the same implementation.composite and that this composite has
exposed references
Posted by "Julien Bigot (JIRA)" <de...@tuscany.apache.org>.
[ https://issues.apache.org/jira/browse/TUSCANY-2982?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12701219#action_12701219 ]
Julien Bigot commented on TUSCANY-2982:
---------------------------------------
The following two patches seems to resolve the issue, however I do not know how dirty the hack it is.
--- modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java.old 2008-12-02 14:02:19.000000000 +0100
+++ modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseWireBuilderImpl.java 2009-04-21 19:34:23.000000000 +0200
@@ -920,15 +920,9 @@
// Resolve the target service
ComponentService target = wire.getTarget();
- if (target != null && target.isUnresolved()) {
- resolvedService = componentServices.get(target.getName());
- if (resolvedService != null) {
- wire.setTarget(target);
- } else {
- warning("WireTargetNotFound", composite, source.getName());
- }
- } else {
- resolvedService = wire.getTarget();
+ resolvedService = componentServices.get(target.getName());
+ if (resolvedService == null) {
+ warning("WireTargetNotFound", composite, source.getName());
}
// Add the target service to the list of targets of the
--- modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java.old 2008-12-02 14:02:18.000000000 +0100
+++ modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/CompositeReferenceImpl.java 2009-04-21 19:09:44.000000000 +0200
@@ -41,7 +41,12 @@
@Override
public Object clone() throws CloneNotSupportedException {
- return super.clone();
+ CompositeReferenceImpl result = (CompositeReferenceImpl) super.clone();
+ result.promotedReferences = new ArrayList<ComponentReference>();
+ for (ComponentReference promotedReference: promotedReferences) {
+ result.promotedReferences.add((ComponentReference)promotedReference.clone());
+ }
+ return result;
}
public List<ComponentReference> getPromotedReferences() {
> Problem when more than one component has the same implementation.composite and that this composite has exposed references
> -------------------------------------------------------------------------------------------------------------------------
>
> Key: TUSCANY-2982
> URL: https://issues.apache.org/jira/browse/TUSCANY-2982
> Project: Tuscany
> Issue Type: Bug
> Components: Java SCA Assembly Model
> Affects Versions: Java-SCA-1.4
> Environment: Linux / JavaSE-1.6
> Reporter: Julien Bigot
>
> When in a hierarchy of instantiated components, two components (even not at the same level of the hierarchy) have the same implementation.composite and that the referenced composite has a reference promoting one (or more) reference of its internal components, connecting these composite references leads to a NullPointerException.
> For example:
> A.componentType
> |-> reference refA
> |-> service servA
> B.composite
> |-> component a: A
> |-> reference refB = a/refA
> C.composite
> |-> component b: B
> |-> reference refC = b/refB
> D.composite
> |-> component a: A
> |-> component b: B
> |-> component c: C
> |-> wire a/servA <-> b/refB
> |-> wire a/servA <-> c/refC
> instantiation of D leads to the following hierarchy
> D/
> |->a
> |->b/
> |->a
> |->c/
> |->b/
> |->a
> There are two instances of B (D/b & D/c/b) and these two instances have a reference (refB) promoting a reference of an internal component (a/refA), this results in the following NullPointerException :
> java.lang.NullPointerException
> at org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl.checkCompatibility(InterfaceContractMapperImpl.java:155)
> at org.apache.tuscany.sca.interfacedef.impl.InterfaceContractMapperImpl.isCompatible(InterfaceContractMapperImpl.java:271)
> at org.apache.tuscany.sca.assembly.builder.impl.BaseWireBuilderImpl.connectWires(BaseWireBuilderImpl.java:940)
> at org.apache.tuscany.sca.assembly.builder.impl.BaseWireBuilderImpl.wireComponentReferences(BaseWireBuilderImpl.java:112)
> from my initial investigations, this seems somehow related to the fact that when cloned, CompositeReferenceImpl's do not clone their promotedReferences attribute, but rather copy it. I didn't manage to get further however.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.