Promote SchemaSourceRepresentation
[yangtools.git] / parser / yang-parser-rfc7950 / src / main / java / org / opendaylight / yangtools / yang / parser / rfc7950 / repo / YangErrorListener.java
index 6d5993417203304504fdeeeed1295098e5dd2c92..319601b52fbdc3cf57854b42d42967e775734f18 100644 (file)
@@ -14,7 +14,7 @@ import java.util.List;
 import org.antlr.v4.runtime.BaseErrorListener;
 import org.antlr.v4.runtime.RecognitionException;
 import org.antlr.v4.runtime.Recognizer;
-import org.opendaylight.yangtools.yang.model.repo.api.SourceIdentifier;
+import org.opendaylight.yangtools.yang.model.api.source.SourceIdentifier;
 import org.opendaylight.yangtools.yang.parser.api.YangSyntaxErrorException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -23,18 +23,18 @@ final class YangErrorListener extends BaseErrorListener {
     private static final Logger LOG = LoggerFactory.getLogger(YangErrorListener.class);
 
     private final List<YangSyntaxErrorException> exceptions = new ArrayList<>();
-    private final SourceIdentifier source;
+    private final SourceIdentifier sourceId;
 
-    YangErrorListener(final SourceIdentifier source) {
-        this.source = requireNonNull(source);
+    YangErrorListener(final SourceIdentifier sourceId) {
+        this.sourceId = requireNonNull(sourceId);
     }
 
     @Override
     @SuppressWarnings("checkstyle:parameterName")
     public void syntaxError(final Recognizer<?, ?> recognizer, final Object offendingSymbol, final int line,
             final int charPositionInLine, final String msg, final RecognitionException e) {
-        LOG.debug("Syntax error in {} at {}:{}: {}", source, line, charPositionInLine, msg, e);
-        exceptions.add(new YangSyntaxErrorException(source, line, charPositionInLine, msg, e));
+        LOG.debug("Syntax error in {} at {}:{}: {}", sourceId, line, charPositionInLine, msg, e);
+        exceptions.add(new YangSyntaxErrorException(sourceId, line, charPositionInLine, msg, e));
     }
 
     void validate() throws YangSyntaxErrorException {
@@ -47,18 +47,18 @@ final class YangErrorListener extends BaseErrorListener {
             throw exceptions.get(0);
         }
 
-        final StringBuilder sb = new StringBuilder();
+        final var sb = new StringBuilder();
         boolean first = true;
-        for (YangSyntaxErrorException e : exceptions) {
+        for (var ex : exceptions) {
             if (first) {
                 first = false;
             } else {
                 sb.append('\n');
             }
 
-            sb.append(e.getFormattedMessage());
+            sb.append(ex.getFormattedMessage());
         }
 
-        throw new YangSyntaxErrorException(source, 0, 0, sb.toString());
+        throw new YangSyntaxErrorException(sourceId, 0, 0, sb.toString());
     }
 }