X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;ds=sidebyside;f=restconf%2Frestconf-nb-rfc8040%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Frestconf%2Fnb%2Frfc8040%2Frests%2Fservices%2Fimpl%2FJSONRestconfServiceRfc8040Impl.java;h=52664062ec135d7091da5424a0a155b413aa7812;hb=b121b01510163f7182432c2de8341702ec960b8b;hp=3fd9e00734d84c3b22c4e5331b51f38da66cd6bc;hpb=a01dad851768102b3182033c10d860f5245d7d26;p=netconf.git diff --git a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/JSONRestconfServiceRfc8040Impl.java b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/JSONRestconfServiceRfc8040Impl.java index 3fd9e00734..52664062ec 100644 --- a/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/JSONRestconfServiceRfc8040Impl.java +++ b/restconf/restconf-nb-rfc8040/src/main/java/org/opendaylight/restconf/nb/rfc8040/rests/services/impl/JSONRestconfServiceRfc8040Impl.java @@ -9,6 +9,7 @@ package org.opendaylight.restconf.nb.rfc8040.rests.services.impl; import com.google.common.base.Optional; import com.google.common.base.Preconditions; +import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -59,11 +60,14 @@ public class JSONRestconfServiceRfc8040Impl implements JSONRestconfService, Auto private final TransactionServicesWrapper services; private final DOMMountPointServiceHandler mountPointServiceHandler; + private final SchemaContextHandler schemaContextHandler; public JSONRestconfServiceRfc8040Impl(final TransactionServicesWrapper services, - final DOMMountPointServiceHandler mountPointServiceHandler) { + final DOMMountPointServiceHandler mountPointServiceHandler, + final SchemaContextHandler schemaContextHandler) { this.services = services; this.mountPointServiceHandler = mountPointServiceHandler; + this.schemaContextHandler = schemaContextHandler; } @SuppressWarnings("checkstyle:IllegalCatch") @@ -148,6 +152,7 @@ public class JSONRestconfServiceRfc8040Impl implements JSONRestconfService, Auto } @SuppressWarnings("checkstyle:IllegalCatch") + @SuppressFBWarnings(value = "NP_NULL_PARAM_DEREF", justification = "Unrecognised NullableDecl") @Override public Optional invokeRpc(final String uriPath, final Optional input) throws OperationFailedException { @@ -190,7 +195,7 @@ public class JSONRestconfServiceRfc8040Impl implements JSONRestconfService, Auto final InputStream entityStream = new ByteArrayInputStream(payload.getBytes(StandardCharsets.UTF_8)); - JsonToPatchBodyReader jsonToPatchBodyReader = new JsonToPatchBodyReader(); + JsonToPatchBodyReader jsonToPatchBodyReader = new JsonToPatchBodyReader(schemaContextHandler); final PatchContext context = jsonToPatchBodyReader.readFrom(uriPath, entityStream); LOG.debug("Parsed YangInstanceIdentifier: {}", context.getInstanceIdentifierContext().getInstanceIdentifier()); @@ -212,8 +217,7 @@ public class JSONRestconfServiceRfc8040Impl implements JSONRestconfService, Auto private NormalizedNodeContext toNormalizedNodeContext(final String uriPath, @Nullable final String payload, final boolean isPost) throws OperationFailedException { final InstanceIdentifierContext instanceIdentifierContext = ParserIdentifier.toInstanceIdentifier( - uriPath, SchemaContextHandler.getSchemaContext(), - Optional.of(mountPointServiceHandler.get())); + uriPath, schemaContextHandler.get(), Optional.of(mountPointServiceHandler.get())); if (payload == null) { return new NormalizedNodeContext(instanceIdentifierContext, null);