Introduce formatting methods for SourceException
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / rfc6020 / effective / EffectiveStmtUtils.java
index 854b857dfeaa9cf9558827469a18573b691b0a00..63c5b10da14e7c349b9c0cab5fecbfd51eec2ade 100644 (file)
@@ -12,22 +12,18 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 
-public final class EffectiveStmtUtils {
+final class EffectiveStmtUtils {
 
     private EffectiveStmtUtils() {
         throw new UnsupportedOperationException("Utility class");
     }
 
-    public static SourceException createNameCollisionSourceException(final StmtContext<?, ?, ?> ctx,
+    static SourceException createNameCollisionSourceException(final StmtContext<?, ?, ?> ctx,
             final EffectiveStatement<?, ?> effectiveStatement) {
-        return new SourceException("Error in module '"
-                + ctx.getRoot().getStatementArgument()
-                + "': can not add '"
-                + effectiveStatement.argument()
-                + "'. Node name collision: '"
-                + effectiveStatement.argument()
-                + "' already declared.",
-                ctx.getStatementSourceReference());
+        return new SourceException(ctx.getStatementSourceReference(),
+            "Error in module '%s': cannot add '%s'. Node name collision: '%s' already declared.",
+            ctx.getRoot().getStatementArgument(),
+            effectiveStatement.argument(),
+            effectiveStatement.argument());
     }
-
 }