From: Maros Marsalek Date: Mon, 1 Jun 2015 11:47:37 +0000 (+0200) Subject: BUG-3436 Fix UNION type leaves resolution in config subsystem X-Git-Tag: release/beryllium~524 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=commitdiff_plain;h=c887866dd664e40a7d14c1bfb107751a6137de97;hp=77bf9003bfe58d57a860164ffcfe7cf3deb8c1be BUG-3436 Fix UNION type leaves resolution in config subsystem The descriptions for comoposite open types were not included in a reconstructed open type, which affected resolution of subsequent composite attributes with leaves of type union. Union leaves rely on description in order to find the artificial JMX attribute in order to pass union value as string. Change-Id: If6222e25840cb854e565ae476509d21ebc19ab3c Signed-off-by: Maros Marsalek (cherry picked from commit 10438f09cbbeb252e58a7fb381e9dd723cc14e2e) --- diff --git a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/resolving/CompositeAttributeResolvingStrategy.java b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/resolving/CompositeAttributeResolvingStrategy.java index 51eb205898..b912a49186 100644 --- a/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/resolving/CompositeAttributeResolvingStrategy.java +++ b/opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/resolving/CompositeAttributeResolvingStrategy.java @@ -56,6 +56,7 @@ class CompositeAttributeResolvingStrategy extends Map> openTypes = Maps.newHashMap(); final String[] names = new String[getOpenType().keySet().size()]; + final String[] descriptions = new String[getOpenType().keySet().size()]; OpenType[] itemTypes = new OpenType[names.length]; int i = 0; @@ -84,6 +85,7 @@ class CompositeAttributeResolvingStrategy extends // fill names + item types in order to reconstruct the open type for current attribute names[i] = yangToJavaAttrMapping.get(innerAttrNameStr); + descriptions[i] = getOpenType().getDescription(names[i]); itemTypes[i] = openTypes.get(innerAttrNameStr); i++; } @@ -91,8 +93,8 @@ class CompositeAttributeResolvingStrategy extends CompositeDataSupport parsedValue; try { LOG.trace("Attribute {} with open type {}. Reconstructing open type.", attrName, getOpenType()); - setOpenType(new CompositeType(getOpenType().getTypeName(), getOpenType().getDescription(), names, names, itemTypes)); - LOG.debug("Attribute {} with open type {}. Open type reconstructed to {}", attrName, getOpenType(), getOpenType()); + setOpenType(new CompositeType(getOpenType().getTypeName(), getOpenType().getDescription(), names, descriptions, itemTypes)); + LOG.debug("Attribute {}. Open type reconstructed to {}", attrName, getOpenType(), getOpenType()); parsedValue = new CompositeDataSupport(getOpenType(), items); } catch (OpenDataException e) { throw new IllegalStateException("An error occurred during restoration of composite type " + this