@Provider
@Consumes({ Draft02.MediaTypes.DATA + RestconfService.XML, Draft02.MediaTypes.OPERATION + RestconfService.XML,
MediaType.APPLICATION_XML, MediaType.TEXT_XML })
-public class XmlNormalizedNodeBodyReader extends AbstractIdentifierAwareJaxRsProvider implements MessageBodyReader<NormalizedNodeContext> {
+public class XmlNormalizedNodeBodyReader extends AbstractIdentifierAwareJaxRsProvider
+ implements MessageBodyReader<NormalizedNodeContext> {
- private final static Logger LOG = LoggerFactory.getLogger(XmlNormalizedNodeBodyReader.class);
+ private static final Logger LOG = LoggerFactory.getLogger(XmlNormalizedNodeBodyReader.class);
@Override
public boolean isReadable(final Class<?> type, final Type genericType, final Annotation[] annotations,
return true;
}
+ @SuppressWarnings("checkstyle:IllegalCatch")
@Override
public NormalizedNodeContext readFrom(final Class<NormalizedNodeContext> type, final Type genericType,
final Annotation[] annotations, final MediaType mediaType,
} else {
return readFrom(entityStream);
}
- } catch (final RestconfDocumentedException e){
+ } catch (final RestconfDocumentedException e) {
throw e;
} catch (final Exception e) {
LOG.debug("Error parsing xml input", e);
final List<YangInstanceIdentifier.PathArgument> iiToDataList = new ArrayList<>();
InstanceIdentifierContext<? extends SchemaNode> outIIContext;
-
// FIXME the factory instance should be cached if the schema context is the same
- final DomToNormalizedNodeParserFactory parserFactory =
- DomToNormalizedNodeParserFactory.getInstance(XmlUtils.DEFAULT_XML_CODEC_PROVIDER, pathContext.getSchemaContext());
+ final DomToNormalizedNodeParserFactory parserFactory = DomToNormalizedNodeParserFactory
+ .getInstance(XmlUtils.DEFAULT_XML_CODEC_PROVIDER, pathContext.getSchemaContext());
if (isPost() && !isRpc) {
final Deque<Object> foundSchemaNodes = findPathToSchemaNodeByName(schemaNode, docRootElm, docRootNamespace);
NormalizedNode<?, ?> parsed = null;
if (schemaNode instanceof ContainerSchemaNode) {
- parsed = parserFactory.getContainerNodeParser().parse(Collections.singletonList(doc.getDocumentElement()), (ContainerSchemaNode) schemaNode);
- } else if(schemaNode instanceof ListSchemaNode) {
+ parsed = parserFactory.getContainerNodeParser().parse(Collections.singletonList(doc.getDocumentElement()),
+ (ContainerSchemaNode) schemaNode);
+ } else if (schemaNode instanceof ListSchemaNode) {
final ListSchemaNode casted = (ListSchemaNode) schemaNode;
parsed = parserFactory.getMapEntryNodeParser().parse(elements, casted);
if (isPost()) {
final YangInstanceIdentifier fullIIToData = YangInstanceIdentifier.create(Iterables.concat(
pathContext.getInstanceIdentifier().getPathArguments(), iiToDataList));
- outIIContext = new InstanceIdentifierContext<>(fullIIToData, pathContext.getSchemaNode(), pathContext.getMountPoint(),
+ outIIContext = new InstanceIdentifierContext<>(fullIIToData, pathContext.getSchemaNode(),
+ pathContext.getMountPoint(),
pathContext.getSchemaContext());
return new NormalizedNodeContext(outIIContext, parsed);
return result;
}
- private static AugmentationSchema findCorrespondingAugment(final DataSchemaNode parent, final DataSchemaNode child) {
+ private static AugmentationSchema findCorrespondingAugment(final DataSchemaNode parent,
+ final DataSchemaNode child) {
if ((parent instanceof AugmentationTarget) && !(parent instanceof ChoiceSchemaNode)) {
for (final AugmentationSchema augmentation : ((AugmentationTarget) parent).getAvailableAugmentations()) {
final DataSchemaNode childInAugmentation = augmentation.getDataChildByName(child.getQName());