* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.netconf.sal.rest.impl;
import com.google.common.base.Preconditions;
-import com.google.common.base.Throwables;
import com.google.common.collect.Iterables;
import com.google.gson.stream.JsonWriter;
import java.io.ByteArrayOutputStream;
import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.CollectionNodeBuilder;
-import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeAttrBuilder;
+import org.opendaylight.yangtools.yang.data.impl.schema.builder.api.DataContainerNodeBuilder;
import org.opendaylight.yangtools.yang.model.api.ContainerSchemaNode;
import org.opendaylight.yangtools.yang.model.api.DataNodeContainer;
import org.opendaylight.yangtools.yang.model.api.DataSchemaNode;
Preconditions.checkState(errorsSchemaNode instanceof ContainerSchemaNode,
"Found Errors SchemaNode isn't ContainerNode");
- final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> errContBuild =
+ final DataContainerNodeBuilder<NodeIdentifier, ContainerNode> errContBuild =
Builders.containerBuilder((ContainerSchemaNode) errorsSchemaNode);
final List<DataSchemaNode> schemaList = ControllerContext.findInstanceDataChildrenByName(errorsSchemaNode,
Preconditions.checkArgument(errListSchemaNode instanceof ListSchemaNode,
"errListSchemaNode has to be of type ListSchemaNode");
final ListSchemaNode listStreamSchemaNode = (ListSchemaNode) errListSchemaNode;
- final DataContainerNodeAttrBuilder<NodeIdentifierWithPredicates, MapEntryNode> errNodeValues = Builders
+ final DataContainerNodeBuilder<NodeIdentifierWithPredicates, MapEntryNode> errNodeValues = Builders
.mapEntryBuilder(listStreamSchemaNode);
List<DataSchemaNode> lsChildDataSchemaNode = ControllerContext.findInstanceDataChildrenByName(
}
private static void writeRootElement(final XMLStreamWriter xmlWriter, final NormalizedNodeWriter nnWriter,
- final ContainerNode data)
- throws IOException {
+ final ContainerNode data) throws IOException {
+ final QName name = SchemaContext.NAME;
try {
- final QName name = SchemaContext.NAME;
xmlWriter.writeStartElement(name.getNamespace().toString(), name.getLocalName());
for (final DataContainerChild<? extends PathArgument, ?> child : data.getValue()) {
nnWriter.write(child);
xmlWriter.writeEndElement();
xmlWriter.flush();
} catch (final XMLStreamException e) {
- Throwables.propagate(e);
+ throw new IOException("Failed to write elements", e);
}
}