summaryrefslogtreecommitdiffstats
path: root/java/sca/samples/dosgi-calculator/src
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-04-07 20:31:59 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-04-07 20:31:59 +0000
commit68e79e1901937b595bd7e507a2103754be844a76 (patch)
tree0f4cecf224c342ffde3b2d42e90163050c5fe033 /java/sca/samples/dosgi-calculator/src
parentd5221777347a39a10f7c31c2590a4088d5c28f0b (diff)
Fix the dependencies to get distributed OSGi samples working inside Eclipse
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@762942 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/samples/dosgi-calculator/src')
-rw-r--r--java/sca/samples/dosgi-calculator/src/main/java/calculator/dosgi/impl/CalculatorServiceImpl.java18
1 files changed, 10 insertions, 8 deletions
diff --git a/java/sca/samples/dosgi-calculator/src/main/java/calculator/dosgi/impl/CalculatorServiceImpl.java b/java/sca/samples/dosgi-calculator/src/main/java/calculator/dosgi/impl/CalculatorServiceImpl.java
index 8a9fea47c0..046e8cf565 100644
--- a/java/sca/samples/dosgi-calculator/src/main/java/calculator/dosgi/impl/CalculatorServiceImpl.java
+++ b/java/sca/samples/dosgi-calculator/src/main/java/calculator/dosgi/impl/CalculatorServiceImpl.java
@@ -6,15 +6,15 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
- * under the License.
+ * under the License.
*/
package calculator.dosgi.impl;
@@ -69,12 +69,14 @@ public class CalculatorServiceImpl implements CalculatorService {
}
}
}
- for (Object s : localServices.getServices()) {
- if (cls.isInstance(s)) {
- System.out.println("Local service: " + s);
- return cls.cast(s);
+ Object[] localObjects = localServices.getServices();
+ if (localObjects != null)
+ for (Object s : localObjects) {
+ if (cls.isInstance(s)) {
+ System.out.println("Local service: " + s);
+ return cls.cast(s);
+ }
}
- }
throw new IllegalStateException(cls.getSimpleName() + " is not available");
}