Use non-deprecated writeValue() 16/111716/2
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 17 May 2024 12:32:56 +0000 (14:32 +0200)
committerRobert Varga <nite@hq.sk>
Fri, 17 May 2024 13:27:00 +0000 (13:27 +0000)
Inline the behaviour of the default method to remove two sources of
warnings.

Change-Id: I5716cafff41d33ae916759f761ca48eb59b7456c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/server/api/YangErrorsBody.java
restconf/restconf-nb/src/main/java/org/opendaylight/restconf/server/spi/YangPatchStatusBody.java

index 48112ecfbc92928f185983014e51bf0ae7b6d12c..e77e3b05c3a525cec88082f97e477f4b5ebed647 100644 (file)
@@ -18,6 +18,7 @@ import org.opendaylight.restconf.api.query.PrettyPrintParam;
 import org.opendaylight.restconf.server.spi.FormattableBodySupport;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev170126.errors.Errors;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.restconf.rev170126.errors.errors.Error;
+import org.opendaylight.yangtools.yang.data.codec.gson.DefaultJSONValueWriter;
 
 /**
  * A {@link FormattableBody} of <a href="https://www.rfc-editor.org/rfc/rfc8040#section-3.9">yang-errors</a> data
@@ -82,7 +83,7 @@ public final class YangErrorsBody extends FormattableBody {
                 if (errorPath != null) {
                     writer.name(ERROR_PATH);
                     errorPath.databind().jsonCodecs().instanceIdentifierCodec()
-                        .writeValue(writer, errorPath.path());
+                        .writeValue(new DefaultJSONValueWriter(writer), errorPath.path());
                 }
                 writer.name(ERROR_TYPE).value(error.type().elementBody());
                 writer.endObject();
index d82329a06d2945bbc0d82fd24f1ef08b98a1867d..b7a9ae79526e9f8ca40c1fc15c1e95861c4ad81c 100644 (file)
@@ -22,6 +22,7 @@ import org.opendaylight.restconf.api.query.PrettyPrintParam;
 import org.opendaylight.restconf.common.errors.RestconfError;
 import org.opendaylight.restconf.server.api.PatchStatusContext;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.patch.rev170222.yang.patch.status.YangPatchStatus;
+import org.opendaylight.yangtools.yang.data.codec.gson.DefaultJSONValueWriter;
 
 /**
  * Result of a {@code PATCH} request as defined in
@@ -130,7 +131,8 @@ public final class YangPatchStatusBody extends FormattableBody {
             final var errorPath = restconfError.getErrorPath();
             if (errorPath != null) {
                 writer.name("error-path");
-                status.databind().jsonCodecs().instanceIdentifierCodec().writeValue(writer, errorPath);
+                status.databind().jsonCodecs().instanceIdentifierCodec()
+                    .writeValue(new DefaultJSONValueWriter(writer), errorPath);
             }
             final var errorMessage = restconfError.getErrorMessage();
             if (errorMessage != null) {