mirror of https://github.com/apache/jclouds.git
Fixed a possible NPE when ServiceFunctionLoader finds no OSGi service for a function.
This commit is contained in:
parent
0666a6fbde
commit
758e01a4d2
|
@ -55,6 +55,7 @@ public class ServiceFunctionLoader implements FunctionLoader {
|
||||||
String filter = String.format("(function=*%s.%s*)", function, ShellToken.SH.to(family));
|
String filter = String.format("(function=*%s.%s*)", function, ShellToken.SH.to(family));
|
||||||
try {
|
try {
|
||||||
references = bundleContext.getServiceReferences(FunctionLoader.class.getName(), filter);
|
references = bundleContext.getServiceReferences(FunctionLoader.class.getName(), filter);
|
||||||
|
if (references != null) {
|
||||||
for (ServiceReference reference : references) {
|
for (ServiceReference reference : references) {
|
||||||
FunctionLoader loader = (FunctionLoader) bundleContext.getService(reference);
|
FunctionLoader loader = (FunctionLoader) bundleContext.getService(reference);
|
||||||
String f = loader.loadFunction(function, family);
|
String f = loader.loadFunction(function, family);
|
||||||
|
@ -62,6 +63,7 @@ public class ServiceFunctionLoader implements FunctionLoader {
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (InvalidSyntaxException e) {
|
} catch (InvalidSyntaxException e) {
|
||||||
throw new FunctionNotFoundException(function, family, e);
|
throw new FunctionNotFoundException(function, family, e);
|
||||||
} finally {
|
} finally {
|
||||||
|
|
Loading…
Reference in New Issue