provide missing module's name via IllegalArgumentException 42/73442/2
authorMichael Vorburger <vorburger@redhat.com>
Tue, 26 Jun 2018 11:09:37 +0000 (13:09 +0200)
committerTom Pantelis <tompantelis@gmail.com>
Tue, 26 Jun 2018 13:17:14 +0000 (13:17 +0000)
by using orElseThrow() instead of get() on Optional<Module> in RpcUtil

to help understand MDSAL-354 problem

JIRA: MDSAL-354
Change-Id: If4d4f663b7cb63acea38acda73686176d27ff56f
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/RpcUtil.java

index 9dbd019..8f9e4ef 100644 (file)
@@ -36,7 +36,8 @@ final class RpcUtil {
     static Collection<SchemaPath> decomposeRpcService(final Class<RpcService> service,
             final SchemaContext schemaContext, final Predicate<RpcRoutingStrategy> filter) {
         final QNameModule moduleName = BindingReflections.getQNameModule(service);
-        final Module module = schemaContext.findModule(moduleName).get();
+        final Module module = schemaContext.findModule(moduleName).orElseThrow(() -> new IllegalArgumentException(
+                "Module not found in SchemaContext: " + moduleName + "; service: " + service));
         LOG.debug("Resolved service {} to module {}", service, module);
 
         final Collection<RpcDefinition> rpcs = module.getRpcs();

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.