X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-rest-connector%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fsal%2Frest%2Fimpl%2FJsonMapper.java;h=7f7e8606c3228d8b2cbebff176a81a5e2fbf9017;hp=fb7872f8bcd4e1efdf27be0183fd20176651ac33;hb=91d7c1ee52322acad08e9f81228ac36b3aa684f5;hpb=1ff9939abc7a4072b07df6b79516fe344b1b42e3 diff --git a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonMapper.java b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonMapper.java index fb7872f8bc..7f7e8606c3 100644 --- a/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonMapper.java +++ b/opendaylight/md-sal/sal-rest-connector/src/main/java/org/opendaylight/controller/sal/rest/impl/JsonMapper.java @@ -43,7 +43,7 @@ class JsonMapper { private final Set foundLeafLists = new HashSet<>(); private final Set foundLists = new HashSet<>(); - private final Logger logger = LoggerFactory.getLogger(JsonMapper.class); + private final Logger logger = LoggerFactory.getLogger(JsonMapper.class); public void write(JsonWriter writer, CompositeNode data, DataNodeContainer schema) throws IOException { Preconditions.checkNotNull(writer); @@ -184,16 +184,23 @@ class JsonMapper { TypeDefinition baseType = RestUtil.resolveBaseTypeFrom(type); + if (node.getValue() == null && !(baseType instanceof EmptyTypeDefinition)) { + logger.debug("While generationg JSON output null value was found for type " + + baseType.getClass().getSimpleName() + "."); + } + // TODO check InstanceIdentifierTypeDefinition if (baseType instanceof IdentityrefTypeDefinition) { if (node.getValue() instanceof QName) { IdentityValuesDTO valueDTO = (IdentityValuesDTO) RestCodec.from(baseType).serialize(node.getValue()); IdentityValue valueFromDTO = valueDTO.getValuesWithNamespaces().get(0); - String moduleName = ControllerContext.getInstance().findModuleByNamespace(URI.create(valueFromDTO.getNamespace())); + String moduleName = ControllerContext.getInstance().findModuleNameByNamespace( + URI.create(valueFromDTO.getNamespace())); writer.value(moduleName + ":" + valueFromDTO.getValue()); } else { logger.debug("Value of " + baseType.getQName().getNamespace() + ":" - + baseType.getQName().getLocalName() + " is not instance of " + QName.class + " but is " + node.getValue().getClass()); + + baseType.getQName().getLocalName() + " is not instance of " + QName.class + " but is " + + node.getValue().getClass()); writer.value(String.valueOf(node.getValue())); } } else if (baseType instanceof DecimalTypeDefinition || baseType instanceof IntegerTypeDefinition