Bug 1401 : Resolving unrecognized field "syntax" error in OperationResult 36/9236/1
authorMadhu Venugopal <mavenugo@gmail.com>
Tue, 22 Jul 2014 14:02:40 +0000 (07:02 -0700)
committerMadhu Venugopal <mavenugo@gmail.com>
Tue, 22 Jul 2014 14:08:37 +0000 (07:08 -0700)
As per RFC 7047, the error field is defined only the the "error" and "details" elements.
But it can also contain other elements that is not described by the RFC.

      "An <error> MAY also have other members that describe the error in more detail.
      This document does not specify the names or values of these members."

The ovsdb-server implementation may choose to add more fields to give more information
to the error.

Since, these fields are not defined in the RFC, we should not fail the JSON parsing
if we encounter unknown fields.

Change-Id: I95c2e5ada6d8b97ff6dfe4f4ed9534ba143e822f
Signed-off-by: Madhu Venugopal <mavenugo@gmail.com>
library/src/main/java/org/opendaylight/ovsdb/lib/impl/FutureTransformUtils.java
library/src/main/java/org/opendaylight/ovsdb/lib/operations/OperationResult.java

index 09524689a3e077e0fe22fdca1af6fbaf4b5c6cb8..0123ed0a5778667f7f8f0e0b47d2dfc64de86da1 100644 (file)
@@ -16,6 +16,7 @@ import java.util.List;
 import org.opendaylight.ovsdb.lib.operations.Operation;
 import org.opendaylight.ovsdb.lib.operations.OperationResult;
 
+import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.google.common.base.Function;
@@ -27,6 +28,7 @@ public class FutureTransformUtils {
 
     public final static ListenableFuture<List<OperationResult>> transformTransactResponse
             (ListenableFuture<List<JsonNode>> transactResponseFuture, final List<Operation> operations) {
+        objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
         return Futures.transform(transactResponseFuture, new Function<List<JsonNode>, List<OperationResult>>() {
             @Override
             public List<OperationResult> apply(List<JsonNode> jsonNodes) {
index 9199c0881aa5abd133078d91ecbbcef62b33fa11..5553ad3f8818238c87368d9cb0aeebbf68ccf245 100644 (file)
@@ -17,6 +17,7 @@ import org.opendaylight.ovsdb.lib.notation.UUID;
 import org.opendaylight.ovsdb.lib.schema.GenericTableSchema;
 
 import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 import com.fasterxml.jackson.annotation.JsonProperty;
 
 // Section 5.2 of ovsdb draft covers the various response structures for
@@ -27,6 +28,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
 // https://trello.com/c/mfTTS86k/28-generic-response-error-handling-especially-for-transact
 // As a temporary measure, adding all the expected responses under the same response.
 
+@JsonIgnoreProperties(ignoreUnknown = true)
 public class OperationResult {
     //public abstract boolean isSuccess();
     private int count;