Fix duplicate in error message 56/103656/4
authorIvan Hrasko <[email protected]>
Mon, 12 Dec 2022 08:46:47 +0000 (09:46 +0100)
committerRobert Varga <[email protected]>
Thu, 29 Dec 2022 18:06:19 +0000 (18:06 +0000)
Fix duplicate occurrence of yang-ext:mount in error message
when operation is not found.

JIRA: NETCONF-926
Change-Id: I2d8f9f1e2f1c4257e3802f7e2df983597f34c6c4
Signed-off-by: Ivan Hrasko <[email protected]>
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/RestconfOperationsServiceImpl.java

index 09ce731ed367cdaedf8b6be4b640471a51378ae7..5fc5155d4b1c8e08293a7ef11afd4a59c7277b95 100644 (file)
@@ -79,11 +79,11 @@ public class RestconfOperationsServiceImpl implements RestconfOperationsService
     @Override
     public NormalizedNodePayload getOperations(final String identifier, final UriInfo uriInfo) {
         if (!identifier.contains(RestconfConstants.MOUNT)) {
-            final String errMsg = "URI has bad format. If operations behind mount point should be showed, URI has to "
-                    + " end with " + RestconfConstants.MOUNT;
+            final var errMsg = """
+                    URI has bad format. If operations behind mount point should be showed, URI has to end with %s.
+                    """.formatted(RestconfConstants.MOUNT);
             LOG.debug("{} for {}", errMsg, identifier);
-            throw new RestconfDocumentedException(errMsg + RestconfConstants.MOUNT, ErrorType.PROTOCOL,
-                    ErrorTag.INVALID_VALUE);
+            throw new RestconfDocumentedException(errMsg, ErrorType.PROTOCOL, ErrorTag.INVALID_VALUE);
         }
 
         final InstanceIdentifierContext mountPointIdentifier = ParserIdentifier.toInstanceIdentifier(identifier,