From: Michael Vorburger Date: Tue, 26 Jun 2018 11:09:37 +0000 (+0200) Subject: provide missing module's name via IllegalArgumentException X-Git-Tag: v3.0.0~45^2~11 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;ds=sidebyside;h=711b2619047caf8d78756f7822f94dfc416e50c2;p=mdsal.git 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/src/main/java/org/opendaylight/controller/blueprint/ext/RpcUtil.java b/src/main/java/org/opendaylight/controller/blueprint/ext/RpcUtil.java index 9dbd019676..8f9e4ef6b2 100644 --- a/src/main/java/org/opendaylight/controller/blueprint/ext/RpcUtil.java +++ b/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();