From: Michael Vorburger Date: Tue, 26 Jun 2018 11:09:37 +0000 (+0200) Subject: provide missing module's name via IllegalArgumentException X-Git-Tag: release/fluorine~66 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=6a119468071021a287c855ecc6cdcbaedea5a539 provide missing module's name via IllegalArgumentException by using orElseThrow() instead of get() on Optional in RpcUtil to help understand MDSAL-354 problem JIRA: MDSAL-354 Change-Id: If4d4f663b7cb63acea38acda73686176d27ff56f Signed-off-by: Michael Vorburger --- diff --git a/opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/RpcUtil.java b/opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/RpcUtil.java index 9dbd019676..8f9e4ef6b2 100644 --- a/opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/RpcUtil.java +++ b/opendaylight/blueprint/src/main/java/org/opendaylight/controller/blueprint/ext/RpcUtil.java @@ -36,7 +36,8 @@ final class RpcUtil { static Collection decomposeRpcService(final Class service, final SchemaContext schemaContext, final Predicate 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 rpcs = module.getRpcs();