X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=yang%2Fyang-parser-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fyangtools%2Fyang%2Fparser%2Fstmt%2Freactor%2FStatementContextBase.java;h=92b2d0bd37c8461dbf6c3ec1412688fe2ed2e9be;hb=refs%2Fchanges%2F68%2F32868%2F1;hp=59a22343e13743e8d9531faf92dea4059bc94adb;hpb=247d8cbf37d124100f9b5263cca97ff5f29c76e7;p=yangtools.git diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java index 59a22343e1..92b2d0bd37 100644 --- a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java +++ b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java @@ -167,12 +167,13 @@ public abstract class StatementContextBase, E } StatementContextBase(final StatementContextBase original) { - this.definition = Preconditions - .checkNotNull(original.definition, "Statement context definition cannot be null"); - this.identifier = Preconditions - .checkNotNull(original.identifier, "Statement context identifier cannot be null"); + this.definition = Preconditions.checkNotNull(original.definition, + "Statement context definition cannot be null copying from: %s", original.getStatementSourceReference()); + this.identifier = Preconditions.checkNotNull(original.identifier, + "Statement context identifier cannot be null copying from: %s", original.getStatementSourceReference()); this.statementDeclSource = Preconditions.checkNotNull(original.statementDeclSource, - "Statement context statementDeclSource cannot be null"); + "Statement context statementDeclSource cannot be null copying from: %s", + original.getStatementSourceReference()); this.completedPhase = null; this.copyHistory.add(TypeOfCopy.ORIGINAL); } @@ -274,10 +275,10 @@ public abstract class StatementContextBase, E final ModelProcessingPhase inProgressPhase = getRoot().getSourceContext().getInProgressPhase(); Preconditions.checkState(inProgressPhase == ModelProcessingPhase.FULL_DECLARATION || inProgressPhase == ModelProcessingPhase.EFFECTIVE_MODEL, - "Effective statement cannot be added in declared phase"); + "Effective statement cannot be added in declared phase at: %s", getStatementSourceReference()); effective.add(Preconditions.checkNotNull(substatement, - "StatementContextBase effective substatement cannot be null")); + "StatementContextBase effective substatement cannot be null at: %s", getStatementSourceReference())); } /** @@ -294,10 +295,10 @@ public abstract class StatementContextBase, E final ModelProcessingPhase inProgressPhase = getRoot().getSourceContext().getInProgressPhase(); Preconditions.checkState(inProgressPhase != ModelProcessingPhase.EFFECTIVE_MODEL, - "Declared statement cannot be added in effective phase"); + "Declared statement cannot be added in effective phase at: %s", getStatementSourceReference()); declared.add(Preconditions.checkNotNull(substatement, - "StatementContextBase declared substatement cannot be null")); + "StatementContextBase declared substatement cannot be null at: %s", getStatementSourceReference())); } /** @@ -382,7 +383,7 @@ public abstract class StatementContextBase, E final SourceSpecificContext sourceContext = getRoot().getSourceContext(); Preconditions.checkState(sourceContext.getInProgressPhase() != ModelProcessingPhase.EFFECTIVE_MODEL, - "Declared statements list cannot be cleared in effective phase"); + "Declared statements list cannot be cleared in effective phase at: %s", getStatementSourceReference()); declared.clear(); } @@ -518,8 +519,10 @@ public abstract class StatementContextBase, E */ void addPhaseCompletedListener(final ModelProcessingPhase phase, final OnPhaseFinished listener) throws SourceException { - Preconditions.checkNotNull(phase, "Statement context processing phase cannot be null"); - Preconditions.checkNotNull(listener, "Statement context phase listener cannot be null"); + Preconditions.checkNotNull(phase, "Statement context processing phase cannot be null at: %s", + getStatementSourceReference()); + Preconditions.checkNotNull(listener, "Statement context phase listener cannot be null at: %s", + getStatementSourceReference()); ModelProcessingPhase finishedPhase = completedPhase; while (finishedPhase != null) { @@ -542,7 +545,8 @@ public abstract class StatementContextBase, E ModelProcessingPhase finishedPhase = completedPhase; while (finishedPhase != null) { if (phase.equals(finishedPhase)) { - throw new IllegalStateException("Mutation registered after phase was completed."); + throw new IllegalStateException("Mutation registered after phase was completed at: " + + getStatementSourceReference()); } finishedPhase = finishedPhase.getPreviousPhase(); }