Class MessageException

  • All Implemented Interfaces:

    public class MessageException
    extends java.lang.RuntimeException
    Runtime exception for "functional" error. It aims to be displayed to end-users, without any technical information like stack traces.
    It's handling depends on the versions of the sonar-batch and sonar-runner. sonar-runner 2.4 will only show the message associated with this exception. Starting from sonar-batch 5.3, this is handled in the batch side, and the main goal is to hide all wrappers of this exception. If this exception is created without cause, then only the message associated with this exception is shown; otherwise, its causes are also shown. Previous combinations of sonar-batch/sonar-runner log all stack trace.
    Message should be clear and complete. Keep in mind that context might not be added to the exception. Names of processed resource and decorator are for example not automatically added when throwing MessageException from org.sonar.api.batch.Decorator.
    See Also:
    Serialized Form
    • Constructor Summary

      Modifier Constructor Description
      protected MessageException​(java.lang.String s)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Throwable fillInStackTrace()
      Does not fill in the stack trace
      java.lang.String l10nKey()  
      java.util.Collection<java.lang.Object> l10nParams()  
      static MessageException of​(java.lang.String message)  
      static MessageException of​(java.lang.String message, java.lang.Throwable cause)  
      static MessageException ofL10n​(java.lang.String l10nKey, java.lang.Object... l10nParams)  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Throwable

        addSuppressed, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • MessageException

        protected MessageException​(java.lang.String s)
    • Method Detail

      • of

        public static MessageException of​(java.lang.String message,
                                          java.lang.Throwable cause)
      • ofL10n

        public static MessageException ofL10n​(java.lang.String l10nKey,
                                              java.lang.Object... l10nParams)
      • fillInStackTrace

        public java.lang.Throwable fillInStackTrace()
        Does not fill in the stack trace
        fillInStackTrace in class java.lang.Throwable
        See Also:
      • toString

        public java.lang.String toString()
        toString in class java.lang.Throwable
      • l10nKey

        public java.lang.String l10nKey()
      • l10nParams

        public java.util.Collection<java.lang.Object> l10nParams()