Move message formatting to StatementSourceException
[yangtools.git] / parser / yang-parser-spi / src / main / java / org / opendaylight / yangtools / yang / parser / spi / source / SourceException.java
index 7bc37cff85dd0d279371b05e5c696a26d44772a9..ec3ce2ab722031b6e9fb6283e5e75afaab0fca41 100644 (file)
@@ -7,8 +7,6 @@
  */
 package org.opendaylight.yangtools.yang.parser.spi.source;
 
-import static java.util.Objects.requireNonNull;
-
 import java.util.Optional;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.jdt.annotation.Nullable;
@@ -31,7 +29,7 @@ public class SourceException extends StatementSourceException {
      * @param sourceRef Statement source
      */
     public SourceException(final @NonNull String message, final @NonNull StatementSourceReference sourceRef) {
-        super(sourceRef, createMessage(message, sourceRef));
+        super(sourceRef, message);
     }
 
     /**
@@ -44,7 +42,7 @@ public class SourceException extends StatementSourceException {
      */
     public SourceException(final @NonNull String message, final @NonNull StatementSourceReference sourceRef,
             final Throwable cause) {
-        super(sourceRef, createMessage(message, sourceRef), cause);
+        super(sourceRef, message, cause);
     }
 
     /**
@@ -228,8 +226,4 @@ public class SourceException extends StatementSourceException {
         throwIf(opt.isEmpty(), stmt, format, args);
         return opt.orElseThrow();
     }
-
-    private static String createMessage(final @NonNull String message, final @NonNull StatementSourceReference source) {
-        return requireNonNull(message) + " [at " + requireNonNull(source) + ']';
-    }
 }