From: Robert Varga Date: Tue, 10 Jan 2023 23:29:26 +0000 (+0100) Subject: Mark a potential CCE X-Git-Tag: v5.0.2~60 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F76%2F103976%2F5;p=netconf.git Mark a potential CCE We have blind cast here, mark it for fixing. Change-Id: I77812192fb772fd8f9224db75bd5adaf0db97f77 Signed-off-by: Robert Varga --- diff --git a/restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/CreateStreamUtil.java b/restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/CreateStreamUtil.java index 274d9660dd..13972dcca9 100644 --- a/restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/CreateStreamUtil.java +++ b/restconf/restconf-nb/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/CreateStreamUtil.java @@ -159,11 +159,16 @@ final class CreateStreamUtil { .map(DataContainerChild::body) .orElseThrow(() -> new RestconfDocumentedException("Mount point not available", ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED)); + + // FIXME: just beautiful: a ClassCastException if it is something different! + final String deviceName = + ((YangInstanceIdentifier.NodeIdentifierWithPredicates.Singleton)value.getLastPathArgument()) + .values().getElement().toString(); + final DOMMountPoint mountPoint = mountPointService.getMountPoint(value) .orElseThrow(() -> new RestconfDocumentedException("Mount point not available", ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED)); - final String deviceName = extractDeviceName(value); final NotificationOutputType outputType = prepareOutputType(data); // FIXME: what is the relationship to the unused refSchemaCtx? @@ -194,11 +199,6 @@ final class CreateStreamUtil { .build()); } - private static String extractDeviceName(final YangInstanceIdentifier iid) { - return ((YangInstanceIdentifier.NodeIdentifierWithPredicates.Singleton)iid.getLastPathArgument()) - .values().getElement().toString(); - } - /** * Prepare {@link NotificationOutputType}. *