From: Yaroslav Lastivka Date: Fri, 15 Dec 2023 10:05:32 +0000 (+0200) Subject: Junos device: Fix IllegalStateException X-Git-Tag: v7.0.0~166 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=3fdf4dd4b0b622ff090331198626259830f54dc3;p=netconf.git Junos device: Fix IllegalStateException To address the IllegalStateException encountered in choice processing, an additional condition has been implemented to check if the choice has cases. This ensures proper handling and avoids the exception. JIRA: NETCONF-938 Change-Id: I3d1062bb5a0505944cffb1d3df1ddc80de5f7e00 Signed-off-by: Yaroslav Lastivka --- diff --git a/restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/impl/SchemasStream.java b/restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/impl/SchemasStream.java index 3ef816f57b..c040728e34 100644 --- a/restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/impl/SchemasStream.java +++ b/restconf/restconf-openapi/src/main/java/org/opendaylight/restconf/openapi/impl/SchemasStream.java @@ -182,7 +182,7 @@ public final class SchemasStream extends InputStream { processDataAndActionNodes(childNode, newTitle, stack, definitionNames, result, newTitle, isConfig); } stack.exit(); - } else if (node instanceof ChoiceSchemaNode choiceNode) { + } else if (node instanceof ChoiceSchemaNode choiceNode && !choiceNode.getCases().isEmpty()) { // Process default case or first case final var caseNode = choiceNode.getDefaultCase() .orElseGet(() -> choiceNode.getCases().stream().findFirst()