From 914a50cc793909ffa813e60f9ac6c73b0cfbb5bc Mon Sep 17 00:00:00 2001 From: Evan Zeller Date: Wed, 14 Feb 2018 15:15:41 -0800 Subject: [PATCH] NETCONF-509: no-input RPCs should use RestconfDocumentedException When invoked with an "input" value currently the implementation throws IllegalStateException up to the servlet container which results in the ugly jetty default error page and reveals stack trace information. Provide a clear message that the invoked RPC should not take any input values. Change-Id: Id13499b80bed9a2ea7666a3aa6d775da341055ab Signed-off-by: Evan Zeller --- .../opendaylight/netconf/sal/restconf/impl/RestconfImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java index 715d66c955..4dc8702f49 100644 --- a/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java +++ b/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/restconf/impl/RestconfImpl.java @@ -525,8 +525,8 @@ public final class RestconfImpl implements RestconfService { if (!rpc.getInput().getChildNodes().isEmpty()) { LOG.debug("RPC " + rpc + " does not need input value."); - // FIXME : find a correct Error from specification - throw new IllegalStateException("RPC " + rpc + " does'n need input value!"); + throw new RestconfDocumentedException("RPC " + rpc + " does not take any input value.", + ErrorType.RPC, ErrorTag.INVALID_VALUE); } final CheckedFuture response; -- 2.36.6