Merge IdentityStatementSupport
[yangtools.git] / yang / yang-parser-rfc7950 / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / stmt / BaseOperationContainerStatementSupport.java
index 02ef0c35a311c1bb57b977be393916d285bb1451..e5c6f53aeb4ee253d5eb3a308122eca71c19aa0d 100644 (file)
@@ -22,6 +22,7 @@ import org.opendaylight.yangtools.yang.model.api.stmt.SchemaTreeEffectiveStateme
 import org.opendaylight.yangtools.yang.parser.spi.meta.EffectiveStmtCtx.Current;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils;
+import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 
 /**
  * Specialization of {@link BaseQNameStatementSupport} for {@code input} and {@code output} statements.
@@ -35,8 +36,8 @@ public abstract class BaseOperationContainerStatementSupport<D extends DeclaredS
     private final Function<QNameModule, QName> createArgument;
 
     protected BaseOperationContainerStatementSupport(final StatementDefinition publicDefinition,
-            final Function<QNameModule, QName> createArgument) {
-        super(publicDefinition);
+            final Function<QNameModule, QName> createArgument, final CopyPolicy copyPolicy) {
+        super(publicDefinition, copyPolicy);
         this.createArgument = requireNonNull(createArgument);
     }
 
@@ -48,7 +49,11 @@ public abstract class BaseOperationContainerStatementSupport<D extends DeclaredS
     @Override
     protected final @NonNull E createDeclaredEffective(final Current<QName, D> stmt,
             final ImmutableList<? extends EffectiveStatement<?, ?>> substatements) {
-        return createDeclaredEffective(historyAndStatusFlags(stmt.history(), substatements), stmt, substatements);
+        try {
+            return createDeclaredEffective(historyAndStatusFlags(stmt.history(), substatements), stmt, substatements);
+        } catch (SubstatementIndexingException e) {
+            throw new SourceException(e.getMessage(), stmt, e);
+        }
     }
 
     protected abstract @NonNull E createDeclaredEffective(int flags, @NonNull Current<QName, D> stmt,