summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-02-10 19:21:20 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2010-02-10 19:21:20 +0000
commita6b6e0162d658413a204160d880f3fe07ed9da02 (patch)
tree8bcd6d30e6689d2c8db443b1f83d77b41e911e2b /sca-java-2.x/trunk/modules
parentc13938be9aa61f32ed023064568a96651338376d (diff)
Fix some of minor bugs discovered by FindBugs
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@908639 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeIncludeBuilderImpl.java2
-rw-r--r--sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java7
-rw-r--r--sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ModelBuilderImpl.java2
-rw-r--r--sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireBuilderImpl.java8
-rw-r--r--sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireMatcherImpl.java2
-rw-r--r--sca-java-2.x/trunk/modules/builder/src/test/java/org/apache/tuscany/sca/builder/impl/BuildPolicyTestCase.java2
6 files changed, 10 insertions, 13 deletions
diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeIncludeBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeIncludeBuilderImpl.java
index b4a897af54..63864e5832 100644
--- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeIncludeBuilderImpl.java
+++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/CompositeIncludeBuilderImpl.java
@@ -84,7 +84,7 @@ public class CompositeIncludeBuilderImpl implements CompositeBuilder {
for (Component component : merged.getComponents()) {
// apply the autowire flag on this composite to any inline
// components - Assembly 5.6 point 4
- if (component.getAutowire() == null && merged.getAutowire() == Boolean.TRUE) {
+ if (component.getAutowire() == null && Boolean.TRUE.equals(merged.getAutowire())) {
component.setAutowire(Boolean.TRUE);
}
// Merge the intents and policySets from the included composite into
diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
index d35513a403..62c6b1031a 100644
--- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
+++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/EndpointReferenceBuilderImpl.java
@@ -47,6 +47,7 @@ import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.policy.Intent;
+import org.oasisopen.sca.ServiceRuntimeException;
/**
* Creates endpoint reference models.
@@ -195,7 +196,7 @@ public class EndpointReferenceBuilderImpl {
// This autowire processing really needs to move to the matching
// algorithm but dependency problems means it has to stay here for now
- if (reference.getAutowire() == Boolean.TRUE && reference.getTargets().isEmpty()) {
+ if (Boolean.TRUE.equals(reference.getAutowire()) && reference.getTargets().isEmpty()) {
// Find suitable targets in the current composite for an
// autowired reference
Multiplicity multiplicity = reference.getMultiplicity();
@@ -475,7 +476,7 @@ public class EndpointReferenceBuilderImpl {
try {
epRefClone = (EndpointReference)epRef.clone();
} catch (Exception e) {
- // Ignore (we know that EndpointReference2 can be cloned)
+ throw new ServiceRuntimeException(e);
} // end try
// Copy across details of the inner reference
//ComponentReference ref = epRefClone.getReference();
@@ -517,7 +518,7 @@ public class EndpointReferenceBuilderImpl {
} else {
// no error if reference is autowire and more targets
// than multiplicity have been found
- if (componentReference.getAutowire() == Boolean.TRUE) {
+ if (Boolean.TRUE.equals(componentReference.getAutowire())) {
break;
}
diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ModelBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ModelBuilderImpl.java
index e76334c041..62a835d214 100644
--- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ModelBuilderImpl.java
+++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/ModelBuilderImpl.java
@@ -32,7 +32,6 @@ import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
public class ModelBuilderImpl implements CompositeBuilder {
private ExtensionPointRegistry registry;
@@ -88,7 +87,6 @@ public class ModelBuilderImpl implements CompositeBuilder {
public Composite build(Composite composite, BuilderContext context)
throws CompositeBuilderException {
- Monitor monitor = context.getMonitor();
try {
// Clone the composites that are included or referenced in implementation.composite
composite = compositeCloneBuilder.build(composite, context);
diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireBuilderImpl.java
index 46524fab0e..fcc27a57b0 100644
--- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireBuilderImpl.java
+++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireBuilderImpl.java
@@ -49,6 +49,7 @@ import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
import org.apache.tuscany.sca.monitor.Monitor;
import org.apache.tuscany.sca.policy.Intent;
+import org.oasisopen.sca.ServiceRuntimeException;
/**
* Creates endpoint reference models.
@@ -330,7 +331,7 @@ public class WireBuilderImpl {
// Get reference targets
List<ComponentService> refTargets = getReferenceTargets(reference);
- if (reference.getAutowire() == Boolean.TRUE && reference.getTargets().isEmpty()) {
+ if (Boolean.TRUE.equals(reference.getAutowire()) && reference.getTargets().isEmpty()) {
// Find suitable targets in the current composite for an
// autowired reference
@@ -703,10 +704,11 @@ public class WireBuilderImpl {
try {
epRefClone = (EndpointReference)epRef.clone();
} catch (Exception e) {
+ throw new ServiceRuntimeException(e);
// Ignore (we know that EndpointReference2 can be cloned)
} // end try
// Copy across details of the inner reference
- ComponentReference ref = epRefClone.getReference();
+ // ComponentReference ref = epRefClone.getReference();
//FIXME
epRefClone.setReference(promotedReference);
return epRefClone;
@@ -738,7 +740,7 @@ public class WireBuilderImpl {
} else {
// no error if reference is autowire and more targets
// than multiplicity have been found
- if (componentReference.getAutowire() == Boolean.TRUE) {
+ if (Boolean.TRUE.equals(componentReference.getAutowire())) {
break;
}
diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireMatcherImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireMatcherImpl.java
index a441d0d8c9..7a8fc1a844 100644
--- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireMatcherImpl.java
+++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/WireMatcherImpl.java
@@ -34,7 +34,6 @@ import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
*
*/
public class WireMatcherImpl implements WireBuilder {
- private ExtensionPointRegistry registry;
private InterfaceContractMapper interfaceContractMapper;
private BuilderExtensionPoint builderExtensionPoint;
@@ -43,7 +42,6 @@ public class WireMatcherImpl implements WireBuilder {
*/
public WireMatcherImpl(ExtensionPointRegistry registry) {
super();
- this.registry = registry;
this.builderExtensionPoint = registry.getExtensionPoint(BuilderExtensionPoint.class);
UtilityExtensionPoint utilities = registry.getExtensionPoint(UtilityExtensionPoint.class);
this.interfaceContractMapper = utilities.getUtility(InterfaceContractMapper.class);
diff --git a/sca-java-2.x/trunk/modules/builder/src/test/java/org/apache/tuscany/sca/builder/impl/BuildPolicyTestCase.java b/sca-java-2.x/trunk/modules/builder/src/test/java/org/apache/tuscany/sca/builder/impl/BuildPolicyTestCase.java
index 0c7105bd9f..b3586a2346 100644
--- a/sca-java-2.x/trunk/modules/builder/src/test/java/org/apache/tuscany/sca/builder/impl/BuildPolicyTestCase.java
+++ b/sca-java-2.x/trunk/modules/builder/src/test/java/org/apache/tuscany/sca/builder/impl/BuildPolicyTestCase.java
@@ -45,7 +45,6 @@ import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensi
import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.core.UtilityExtensionPoint;
import org.apache.tuscany.sca.definitions.Definitions;
import org.apache.tuscany.sca.monitor.Monitor;
@@ -73,7 +72,6 @@ public class BuildPolicyTestCase {
public static void setUp() throws Exception {
DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
context = new ProcessorContext(extensionPoints);
- FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
compositeBuilder =
extensionPoints.getExtensionPoint(BuilderExtensionPoint.class)