X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=restconf%2Fsal-rest-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fsal%2Frest%2Fimpl%2FJsonToPATCHBodyReader.java;h=9968a25fc06adcdf0feae4a1b7dacc3b3eb0d771;hb=d548af6597c884273cec0b306b1a2bd77912df48;hp=ffb47bd352159540e3ca24c960d6263898977f82;hpb=f3a63a5aa4a59f3dd47f0e62ea900416e4a37811;p=netconf.git diff --git a/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonToPATCHBodyReader.java b/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonToPATCHBodyReader.java index ffb47bd352..9968a25fc0 100644 --- a/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonToPATCHBodyReader.java +++ b/restconf/sal-rest-connector/src/main/java/org/opendaylight/netconf/sal/rest/impl/JsonToPATCHBodyReader.java @@ -273,7 +273,11 @@ public class JsonToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider value.append("["); while (in.hasNext()) { - readValueObject(value, in); + if (in.peek() == JsonToken.STRING) { + value.append("\"" + in.nextString() + "\""); + } else { + readValueObject(value, in); + } if (in.peek() != JsonToken.END_ARRAY) { value.append(","); } @@ -311,7 +315,11 @@ public class JsonToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider value.append("["); while (in.hasNext()) { - readValueObject(value, in); + if (in.peek() == JsonToken.STRING) { + value.append("\"" + in.nextString() + "\""); + } else { + readValueObject(value, in); + } if (in.peek() != JsonToken.END_ARRAY) { value.append(","); } @@ -338,7 +346,7 @@ public class JsonToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider * @param in reader JsonReader reader * @return NormalizedNode representing data */ - private NormalizedNode readEditData(@Nonnull final JsonReader in, @Nonnull final SchemaNode targetSchemaNode, + private static NormalizedNode readEditData(@Nonnull final JsonReader in, @Nonnull final SchemaNode targetSchemaNode, @Nonnull final InstanceIdentifierContext path) { final NormalizedNodeResult resultHolder = new NormalizedNodeResult(); final NormalizedNodeStreamWriter writer = ImmutableNormalizedNodeStreamWriter.from(resultHolder); @@ -352,7 +360,7 @@ public class JsonToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider * @param edit Instance of PatchEdit * @return PATCHEntity */ - private PATCHEntity prepareEditOperation(@Nonnull final PatchEdit edit) { + private static PATCHEntity prepareEditOperation(@Nonnull final PatchEdit edit) { if ((edit.getOperation() != null) && (edit.getTargetSchemaNode() != null) && checkDataPresence(edit.getOperation(), (edit.getData() != null))) { if (isPatchOperationWithValue(edit.getOperation())) { @@ -380,19 +388,11 @@ public class JsonToPATCHBodyReader extends AbstractIdentifierAwareJaxRsProvider * @return true if data is present when operation requires it or if there are no data when operation does not * allow it, false otherwise */ - private boolean checkDataPresence(@Nonnull final String operation, final boolean hasData) { + private static boolean checkDataPresence(@Nonnull final String operation, final boolean hasData) { if (isPatchOperationWithValue(operation)) { - if (hasData) { - return true; - } else { - return false; - } + return hasData; } else { - if (!hasData) { - return true; - } else { - return false; - } + return !hasData; } }