For anyxml data, a ClassCastException occurs at
XmlDocumentUtils.createXmlRootElement(XmlDocumentUtils.java:180) when
blindly casting the schema instance to DataNodeContainer - the actual
instance is an AnyXmlSchemaNode. To prevent this, the code should first
check "schema instanceof DataNodeContainer". 'childSchema' will be null
but that's expected for anyxml as it doesn't have a schema.
Change-Id: Ib2497e99ddf329961114c214320f6283d13a5272
Signed-off-by: tpantelis <tpanteli@brocade.com>
} else { // CompositeNode
for (Node<?> child : ((CompositeNode) data).getValue()) {
DataSchemaNode childSchema = null;
- if (schema != null) {
+ if (schema instanceof DataNodeContainer) {
childSchema = findFirstSchemaForNode(child, ((DataNodeContainer) schema).getChildNodes());
if (logger.isDebugEnabled()) {
if (childSchema == null) {