From 68e79e1901937b595bd7e507a2103754be844a76 Mon Sep 17 00:00:00 2001 From: rfeng Date: Tue, 7 Apr 2009 20:31:59 +0000 Subject: 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 --- .../calculator/dosgi/impl/CalculatorServiceImpl.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'java/sca/samples/dosgi-calculator/src') 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"); } -- cgit v1.2.3