Fix a bunch of sonar warnings around declaring runtime exceptions.
Change-Id: I6e8267e29ef6c0d3f2d220531ca656ff564331ec
Signed-off-by: Robert Varga <rovarga@cisco.com>
}
@Override
- public void leafNode(final String localName, final Object value) throws IOException, IllegalArgumentException {
+ public void leafNode(final String localName, final Object value) throws IOException {
Entry<NodeIdentifier, Object> dom = serializeLeaf(localName, value);
getDelegate().leafNode(dom.getKey(), dom.getValue());
}
@Override
- public void anyxmlNode(final String name, final Object value) throws IOException, IllegalArgumentException {
+ public void anyxmlNode(final String name, final Object value) throws IOException {
Entry<NodeIdentifier, Object> dom = serializeLeaf(name, value);
getDelegate().anyxmlNode(dom.getKey(), dom.getValue());
}
@Override
- public void leafSetEntryNode(final Object value) throws IOException, IllegalArgumentException {
+ public void leafSetEntryNode(final Object value) throws IOException {
LeafNodeCodecContext<?> ctx = (LeafNodeCodecContext<?>) current();
getDelegate().leafSetEntryNode(ctx.getValueCodec().serialize(value));
}
@Override
- public void startAugmentationNode(final Class<? extends Augmentation<?>> augmentationType)
- throws IOException, IllegalArgumentException {
+ public void startAugmentationNode(final Class<? extends Augmentation<?>> augmentationType) throws IOException {
getDelegate().startAugmentationNode(enter(augmentationType, AugmentationIdentifier.class));
}
@Override
- public void startCase(final Class<? extends DataObject> caze, final int childSizeHint)
- throws IllegalArgumentException {
+ public void startCase(final Class<? extends DataObject> caze, final int childSizeHint) {
enter(caze, NodeIdentifier.class);
}
@Override
- public void startChoiceNode(final Class<? extends DataContainer> type, final int childSizeHint)
- throws IOException, IllegalArgumentException {
+ public void startChoiceNode(final Class<? extends DataContainer> type, final int childSizeHint) throws IOException {
getDelegate().startChoiceNode(enter(type, NodeIdentifier.class), childSizeHint);
}
@Override
public void startContainerNode(final Class<? extends DataObject> object, final int childSizeHint)
- throws IOException, IllegalArgumentException {
+ throws IOException {
getDelegate().startContainerNode(enter(object, NodeIdentifier.class), childSizeHint);
}
@Override
- public void startLeafSet(final String localName, final int childSizeHint) throws IOException, IllegalArgumentException {
+ public void startLeafSet(final String localName, final int childSizeHint) throws IOException {
getDelegate().startLeafSet(enter(localName, NodeIdentifier.class), childSizeHint);
}
@Override
- public void startMapEntryNode(final Identifier<?> key, final int childSizeHint) throws IOException, IllegalArgumentException {
+ public void startMapEntryNode(final Identifier<?> key, final int childSizeHint) throws IOException {
duplicateSchemaEnter();
NodeIdentifierWithPredicates identifier = ((KeyedListNodeCodecContext<?>) current()).serialize(key);
getDelegate().startMapEntryNode(identifier, childSizeHint);
@Override
public <T extends DataObject & Identifiable<?>> void startMapNode(final Class<T> mapEntryType,
- final int childSizeHint) throws IOException, IllegalArgumentException {
+ final int childSizeHint) throws IOException {
getDelegate().startMapNode(enter(mapEntryType, NodeIdentifier.class), childSizeHint);
}
@Override
public <T extends DataObject & Identifiable<?>> void startOrderedMapNode(final Class<T> mapEntryType,
- final int childSizeHint) throws IOException, IllegalArgumentException {
+ final int childSizeHint) throws IOException {
getDelegate().startOrderedMapNode(enter(mapEntryType, NodeIdentifier.class), childSizeHint);
}
@Override
- public void startUnkeyedList(final Class<? extends DataObject> obj, final int childSizeHint)
- throws IOException, IllegalArgumentException {
+ public void startUnkeyedList(final Class<? extends DataObject> obj, final int childSizeHint) throws IOException {
getDelegate().startUnkeyedList(enter(obj, NodeIdentifier.class), childSizeHint);
}
@Override
- public void startUnkeyedListItem(final int childSizeHint) throws IllegalStateException, IOException {
+ public void startUnkeyedListItem(final int childSizeHint) throws IOException {
getDelegate().startUnkeyedListItem(duplicateSchemaEnter(), childSizeHint);
}
}
@Override
- public void leafSetEntryNode(final Object value, final Map<QName, String> attributes) throws IOException, IllegalArgumentException {
+ public void leafSetEntryNode(final Object value, final Map<QName, String> attributes) throws IOException {
final LeafListSchemaNode schema = tracker.leafSetEntryNode();
writeElement(schema.getQName(), schema, value, attributes);
}
@Override
- public void startContainerNode(final NodeIdentifier name, final int childSizeHint, final Map<QName, String> attributes) throws IOException, IllegalArgumentException {
+ public void startContainerNode(final NodeIdentifier name, final int childSizeHint, final Map<QName, String> attributes) throws IOException {
startContainerNode(name, childSizeHint);
writeAttributes(attributes);
}
@Override
- public void startUnkeyedListItem(final NodeIdentifier name, final int childSizeHint, final Map<QName, String> attributes) throws IOException, IllegalStateException {
+ public void startUnkeyedListItem(final NodeIdentifier name, final int childSizeHint, final Map<QName, String> attributes) throws IOException {
startUnkeyedListItem(name, childSizeHint);
writeAttributes(attributes);
}
@Override
- public void startMapEntryNode(final NodeIdentifierWithPredicates identifier, final int childSizeHint, final Map<QName, String> attributes) throws IOException, IllegalArgumentException {
+ public void startMapEntryNode(final NodeIdentifierWithPredicates identifier, final int childSizeHint, final Map<QName, String> attributes) throws IOException {
startMapEntryNode(identifier, childSizeHint);
writeAttributes(attributes);
}
}
@Override
- public Object getProperty(final String name) throws IllegalArgumentException {
+ public Object getProperty(final String name) {
return writer.getProperty(name);
}
}
}
@Override
- public void leafNode(final NodeIdentifier name, final Object value) throws IllegalArgumentException {
+ public void leafNode(final NodeIdentifier name, final Object value) {
checkDataNodeContainer();
writeChild(ImmutableNodes.leafNode(name, value));
}
@Override
- public void startLeafSet(final NodeIdentifier name, final int childSizeHint) throws IllegalArgumentException {
+ public void startLeafSet(final NodeIdentifier name, final int childSizeHint) {
checkDataNodeContainer();
ListNodeBuilder<Object, LeafSetEntryNode<Object>> builder = UNKNOWN_SIZE == childSizeHint ?
ImmutableLeafSetNodeBuilder.create() : ImmutableLeafSetNodeBuilder.create(childSizeHint);
}
@Override
- public void leafSetEntryNode(final Object value) throws IllegalArgumentException {
+ public void leafSetEntryNode(final Object value) {
Preconditions.checkArgument(getCurrent() instanceof ImmutableLeafSetNodeBuilder<?>);
@SuppressWarnings("unchecked")
ListNodeBuilder<Object, LeafSetEntryNode<Object>> builder = ((ImmutableLeafSetNodeBuilder<Object>) getCurrent());
}
@Override
- public void anyxmlNode(final NodeIdentifier name, final Object value) throws IllegalArgumentException {
+ public void anyxmlNode(final NodeIdentifier name, final Object value) {
checkDataNodeContainer();
}
@Override
- public void startContainerNode(final NodeIdentifier name, final int childSizeHint) throws IllegalArgumentException {
+ public void startContainerNode(final NodeIdentifier name, final int childSizeHint) {
checkDataNodeContainer();
final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> builder = UNKNOWN_SIZE == childSizeHint ?
}
@Override
- public void startUnkeyedList(final NodeIdentifier name, final int childSizeHint) throws IllegalArgumentException {
+ public void startUnkeyedList(final NodeIdentifier name, final int childSizeHint) {
checkDataNodeContainer();
final CollectionNodeBuilder<UnkeyedListEntryNode, UnkeyedListNode> builder = UNKNOWN_SIZE == childSizeHint ?
}
@Override
- public void startUnkeyedListItem(final NodeIdentifier name, final int childSizeHint) throws IllegalStateException {
+ public void startUnkeyedListItem(final NodeIdentifier name, final int childSizeHint) {
Preconditions.checkArgument(getCurrent() instanceof ImmutableUnkeyedListNodeBuilder);
final DataContainerNodeAttrBuilder<NodeIdentifier, UnkeyedListEntryNode> builder = UNKNOWN_SIZE == childSizeHint ?
}
@Override
- public void startMapNode(final NodeIdentifier name, final int childSizeHint) throws IllegalArgumentException {
+ public void startMapNode(final NodeIdentifier name, final int childSizeHint) {
checkDataNodeContainer();
final CollectionNodeBuilder<MapEntryNode, MapNode> builder = UNKNOWN_SIZE == childSizeHint ?
}
@Override
- public void startMapEntryNode(final NodeIdentifierWithPredicates identifier, final int childSizeHint) throws IllegalArgumentException {
+ public void startMapEntryNode(final NodeIdentifierWithPredicates identifier, final int childSizeHint) {
if(!(getCurrent() instanceof NormalizedNodeResultBuilder)) {
Preconditions.checkArgument(getCurrent() instanceof ImmutableMapNodeBuilder || getCurrent() instanceof ImmutableOrderedMapNodeBuilder);
}
}
@Override
- public void startOrderedMapNode(final NodeIdentifier name, final int childSizeHint) throws IllegalArgumentException {
+ public void startOrderedMapNode(final NodeIdentifier name, final int childSizeHint) {
checkDataNodeContainer();
final CollectionNodeBuilder<MapEntryNode, OrderedMapNode> builder = UNKNOWN_SIZE == childSizeHint ?
}
@Override
- public void startChoiceNode(final NodeIdentifier name, final int childSizeHint) throws IllegalArgumentException {
+ public void startChoiceNode(final NodeIdentifier name, final int childSizeHint) {
checkDataNodeContainer();
final DataContainerNodeBuilder<NodeIdentifier, ChoiceNode> builder = UNKNOWN_SIZE == childSizeHint ?
}
@Override
- public void startAugmentationNode(final AugmentationIdentifier identifier) throws IllegalArgumentException {
+ public void startAugmentationNode(final AugmentationIdentifier identifier) {
checkDataNodeContainer();
Preconditions.checkArgument(!(getCurrent() instanceof ImmutableAugmentationNodeBuilder));
enter(Builders.augmentationBuilder().withNodeIdentifier(identifier));
private void checkDataNodeContainer() {
@SuppressWarnings("rawtypes")
NormalizedNodeContainerBuilder current = getCurrent();
- if(!(current instanceof NormalizedNodeResultBuilder)) {
- Preconditions.checkArgument(current instanceof DataContainerNodeBuilder<?, ?>, "Invalid nesting of data.");
+ if (!(current instanceof NormalizedNodeResultBuilder)) {
+ Preconditions.checkArgument(current instanceof DataContainerNodeBuilder<?, ?>, "Invalid nesting of data.");
}
}