diff options
Diffstat (limited to 'netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl')
6 files changed, 15 insertions, 15 deletions
diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/DepthAwareNormalizedNodeWriter.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/DepthAwareNormalizedNodeWriter.java index b9d7a7a..842fb74 100644 --- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/DepthAwareNormalizedNodeWriter.java +++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/DepthAwareNormalizedNodeWriter.java @@ -279,7 +279,7 @@ public class DepthAwareNormalizedNodeWriter implements RestconfNormalizedNodeWri for (final QName qname : qnames) { final Optional<? extends NormalizedNode> child = node.findChildByArg(new NodeIdentifier(qname)); if (child.isPresent()) { - write(child.get()); + write(child.orElseThrow()); } else { LOG.info("No child for key element {} found", qname); } diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java index aecea7a..4f02a08 100644 --- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java +++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonNormalizedNodeBodyReader.java @@ -125,7 +125,7 @@ public class JsonNormalizedNodeBodyReader final JsonParserStream jsonParser = JsonParserStream.create(writer, JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02.getShared(path.getSchemaContext()), parentInference); - final JsonReader reader = new JsonReader(new InputStreamReader(nonEmptyInputStreamOptional.get(), + final JsonReader reader = new JsonReader(new InputStreamReader(nonEmptyInputStreamOptional.orElseThrow(), StandardCharsets.UTF_8)); jsonParser.parse(reader); diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonToPatchBodyReader.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonToPatchBodyReader.java index ce5a8c4..3fe1233 100644 --- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonToPatchBodyReader.java +++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonToPatchBodyReader.java @@ -114,7 +114,7 @@ public class JsonToPatchBodyReader extends AbstractIdentifierAwareJaxRsProvider return new PatchContext(path, null, null); } - final JsonReader jsonReader = new JsonReader(new InputStreamReader(nonEmptyInputStreamOptional.get(), + final JsonReader jsonReader = new JsonReader(new InputStreamReader(nonEmptyInputStreamOptional.orElseThrow(), StandardCharsets.UTF_8)); AtomicReference<String> patchId = new AtomicReference<>(); final List<PatchEntity> resultList = read(jsonReader, path, patchId); diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/RestconfDocumentedExceptionMapper.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/RestconfDocumentedExceptionMapper.java index ff0be39..19d93f0 100644 --- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/RestconfDocumentedExceptionMapper.java +++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/RestconfDocumentedExceptionMapper.java @@ -54,8 +54,8 @@ import org.opendaylight.yangtools.yang.data.codec.gson.JSONCodecFactorySupplier; import org.opendaylight.yangtools.yang.data.codec.gson.JSONNormalizedNodeStreamWriter; import org.opendaylight.yangtools.yang.data.codec.gson.JsonWriterFactory; import org.opendaylight.yangtools.yang.data.codec.xml.XMLStreamNormalizedNodeStreamWriter; +import org.opendaylight.yangtools.yang.data.impl.schema.Builders; import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes; -import org.opendaylight.yangtools.yang.data.impl.schema.SchemaAwareBuilders; import org.opendaylight.yangtools.yang.model.api.DataSchemaNode; import org.opendaylight.yangtools.yang.model.api.LeafSchemaNode; import org.opendaylight.yangtools.yang.model.api.ListSchemaNode; @@ -123,14 +123,14 @@ public class RestconfDocumentedExceptionMapper implements ExceptionMapper<Restco final var errorsSchemaNode = errorsEntry.getValue(); final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> errContBuild = - SchemaAwareBuilders.containerBuilder(errorsSchemaNode); + Builders.containerBuilder(); final var schemaList = ControllerContext.findInstanceDataChildrenByName(errorsSchemaNode, Draft02.RestConfModule.ERROR_LIST_SCHEMA_NODE); final DataSchemaNode errListSchemaNode = ControllerContext.getFirst(schemaList); checkState(errListSchemaNode instanceof ListSchemaNode, "Found Error SchemaNode isn't ListSchemaNode"); - final CollectionNodeBuilder<MapEntryNode, SystemMapNode> listErorsBuilder = SchemaAwareBuilders - .mapBuilder((ListSchemaNode) errListSchemaNode); + final CollectionNodeBuilder<MapEntryNode, SystemMapNode> listErorsBuilder = Builders + .mapBuilder(); for (final RestconfError error : errors) { @@ -155,21 +155,21 @@ public class RestconfDocumentedExceptionMapper implements ExceptionMapper<Restco checkArgument(errListSchemaNode instanceof ListSchemaNode, "errListSchemaNode has to be of type ListSchemaNode"); final ListSchemaNode listStreamSchemaNode = (ListSchemaNode) errListSchemaNode; - final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> errNodeValues = SchemaAwareBuilders - .mapEntryBuilder(listStreamSchemaNode); + final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> errNodeValues = Builders + .mapEntryBuilder(); var lsChildDataSchemaNode = ControllerContext.findInstanceDataChildrenByName( listStreamSchemaNode, "error-type"); final DataSchemaNode errTypSchemaNode = ControllerContext.getFirst(lsChildDataSchemaNode); checkState(errTypSchemaNode instanceof LeafSchemaNode); - errNodeValues.withChild(SchemaAwareBuilders.leafBuilder((LeafSchemaNode) errTypSchemaNode) + errNodeValues.withChild(Builders.leafBuilder() .withValue(error.getErrorType().elementBody()).build()); lsChildDataSchemaNode = ControllerContext.findInstanceDataChildrenByName( listStreamSchemaNode, "error-tag"); final DataSchemaNode errTagSchemaNode = ControllerContext.getFirst(lsChildDataSchemaNode); checkState(errTagSchemaNode instanceof LeafSchemaNode); - errNodeValues.withChild(SchemaAwareBuilders.leafBuilder((LeafSchemaNode) errTagSchemaNode) + errNodeValues.withChild(Builders.leafBuilder() .withValue(error.getErrorTag().elementBody()).build()); if (error.getErrorAppTag() != null) { @@ -177,7 +177,7 @@ public class RestconfDocumentedExceptionMapper implements ExceptionMapper<Restco listStreamSchemaNode, "error-app-tag"); final DataSchemaNode errAppTagSchemaNode = ControllerContext.getFirst(lsChildDataSchemaNode); checkState(errAppTagSchemaNode instanceof LeafSchemaNode); - errNodeValues.withChild(SchemaAwareBuilders.leafBuilder((LeafSchemaNode) errAppTagSchemaNode) + errNodeValues.withChild(Builders.leafBuilder() .withValue(error.getErrorAppTag()).build()); } @@ -185,7 +185,7 @@ public class RestconfDocumentedExceptionMapper implements ExceptionMapper<Restco listStreamSchemaNode, "error-message"); final DataSchemaNode errMsgSchemaNode = ControllerContext.getFirst(lsChildDataSchemaNode); checkState(errMsgSchemaNode instanceof LeafSchemaNode); - errNodeValues.withChild(SchemaAwareBuilders.leafBuilder((LeafSchemaNode) errMsgSchemaNode) + errNodeValues.withChild(Builders.leafBuilder() .withValue(error.getErrorMessage()).build()); if (error.getErrorInfo() != null) { diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlNormalizedNodeBodyReader.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlNormalizedNodeBodyReader.java index 84a7978..cc03aa6 100644 --- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlNormalizedNodeBodyReader.java +++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlNormalizedNodeBodyReader.java @@ -107,7 +107,7 @@ public class XmlNormalizedNodeBodyReader extends AbstractIdentifierAwareJaxRsPro return new NormalizedNodeContext(path, null); } - final Document doc = UntrustedXML.newDocumentBuilder().parse(nonEmptyInputStreamOptional.get()); + final Document doc = UntrustedXML.newDocumentBuilder().parse(nonEmptyInputStreamOptional.orElseThrow()); return parse(path, doc); } diff --git a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlToPatchBodyReader.java b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlToPatchBodyReader.java index 9cc4766..7716cea 100644 --- a/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlToPatchBodyReader.java +++ b/netconf/restconf/restconf-nb-bierman02/src/main/java/org/opendaylight/netconf/sal/rest/impl/XmlToPatchBodyReader.java @@ -107,7 +107,7 @@ public class XmlToPatchBodyReader extends AbstractIdentifierAwareJaxRsProvider i return new PatchContext(path, null, null); } - final Document doc = UntrustedXML.newDocumentBuilder().parse(nonEmptyInputStreamOptional.get()); + final Document doc = UntrustedXML.newDocumentBuilder().parse(nonEmptyInputStreamOptional.orElseThrow()); return parse(path, doc); } catch (final RestconfDocumentedException e) { throw e; |