Bug 2438: No serializer found for class.. BooleanBaseType 81/15881/1
authorSam Hague <shague@redhat.com>
Mon, 2 Mar 2015 02:40:21 +0000 (21:40 -0500)
committerSam Hague <shague@redhat.com>
Mon, 2 Mar 2015 02:40:21 +0000 (21:40 -0500)
When using the OVSDB Northbound v3 APIs the below error is returned when GET'ting tables that contain boolean columns.

http://{{controllerHost}}:{{controllerPort}}/ovsdb/nb/v3/node/OVS|192.168.120.31:48161/database/Open_vSwitch/table/Bridge

No serializer found for class org.opendaylight.ovsdb.lib.schema.BaseType$BooleanBaseType and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) (through reference chain: org.opendaylight.ovsdb.lib.schema.GenericTableSchema["columnSchemas"]->java.util.HashMap["stp_enable"]->org.opendaylight.ovsdb.lib.schema.ColumnSchema["type"]->org.opendaylight.ovsdb.lib.schema.AtomicColumnType["baseType"])

The boolean type does not have a public getter/setter since it doesn't need one but this error comes from that.

Configure the object mapper to safely ignore the error.

Change-Id: I1fc0cca6b48a698f711dc61b4a33763ff2fa521d
Signed-off-by: Sam Hague <shague@redhat.com>
northbound/src/main/java/org/opendaylight/ovsdb/northbound/DatabaseResource.java
northbound/src/main/java/org/opendaylight/ovsdb/northbound/NodeResource.java
northbound/src/main/java/org/opendaylight/ovsdb/northbound/RowResource.java
northbound/src/main/java/org/opendaylight/ovsdb/northbound/TableResource.java

index 70bde89d730cb61bac359d493afab7d2fcc6781e..9552984c110f1885fce4aa79feb27eefeead2c52 100644 (file)
@@ -1,5 +1,6 @@
 package org.opendaylight.ovsdb.northbound;
 
+import com.fasterxml.jackson.databind.SerializationFeature;
 import java.util.List;
 
 import javax.ws.rs.GET;
@@ -10,11 +11,8 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.Response;
 
 import org.opendaylight.controller.northbound.commons.exception.InternalServerErrorException;
-import org.opendaylight.controller.sal.core.Node;
-import org.opendaylight.controller.sal.utils.ServiceHelper;
 import org.opendaylight.ovsdb.lib.OvsdbClient;
 import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
-import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.DeserializationFeature;
@@ -31,6 +29,7 @@ public class DatabaseResource {
         this.nodeId = id;
         objectMapper = new ObjectMapper();
         objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+        objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
     }
 
     private DatabaseSchema getDatabaseSchema (String databaseName) {
index e3ed0d2fb6bfdc42254b4708002c935989851af6..3cdf0f126d5fe6a455231cda71547ceb7b01e259 100644 (file)
@@ -1,5 +1,6 @@
 package org.opendaylight.ovsdb.northbound;
 
+import com.fasterxml.jackson.databind.SerializationFeature;
 import java.io.InputStream;
 import java.util.List;
 
@@ -36,6 +37,7 @@ public class NodeResource {
     public NodeResource () {
         objectMapper = new ObjectMapper();
         objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+        objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
     }
 
     public static Node getOvsdbNode(String nodeId, Object bundleClassRef) {
index b1f3435fd0d1bc07c185f65ad265457fefaf664a..038a0b597a17e4a1fe8c38e868ef5e8c2d2b849a 100644 (file)
@@ -1,5 +1,6 @@
 package org.opendaylight.ovsdb.northbound;
 
+import com.fasterxml.jackson.databind.SerializationFeature;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
@@ -50,7 +51,7 @@ public class RowResource {
         this.tableName = tableName;
         objectMapper = new ObjectMapper();
         objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-
+        objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
     }
 
     private OvsdbRow getOvsdbRow (InputStream stream) throws IOException {
index 61bf7f9953565b2228f4707c7f231cb795efceef..46ae46ad76cfaecc900bb329c327a54f4aace105 100644 (file)
@@ -1,5 +1,6 @@
 package org.opendaylight.ovsdb.northbound;
 
+import com.fasterxml.jackson.databind.SerializationFeature;
 import java.util.Set;
 
 import javax.ws.rs.GET;
@@ -31,7 +32,7 @@ public class TableResource {
         this.databaseName = databaseName;
         objectMapper = new ObjectMapper();
         objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
-
+        objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
     }
 
     private DatabaseSchema getDatabaseSchema (String databaseName) {