From c887866dd664e40a7d14c1bfb107751a6137de97 Mon Sep 17 00:00:00 2001 From: Maros Marsalek Date: Mon, 1 Jun 2015 13:47:37 +0200 Subject: [PATCH 1/1] 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) --- .../resolving/CompositeAttributeResolvingStrategy.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) 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 -- 2.36.6