From 3fdf4dd4b0b622ff090331198626259830f54dc3 Mon Sep 17 00:00:00 2001 From: Yaroslav Lastivka Date: Fri, 15 Dec 2023 12:05:32 +0200 Subject: [PATCH] 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 --- .../org/opendaylight/restconf/openapi/impl/SchemasStream.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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() -- 2.36.6