diff options
Diffstat (limited to 'java/sca/samples/dosgi-calculator/src')
-rw-r--r-- | java/sca/samples/dosgi-calculator/src/main/java/calculator/dosgi/impl/CalculatorServiceImpl.java | 18 |
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");
}
|