aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api/src/main/java/org/sonar/api/utils/MessageException.java
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2013-08-14 17:43:52 +0200
committerJulien Lancelot <julien.lancelot@gmail.com>2013-08-14 17:43:52 +0200
commit3554f0dddfbacee2e11c6c73ca084cfca1d2bb2d (patch)
treec2e7589d13472c943be9934a66e4470bf3f925b1 /sonar-plugin-api/src/main/java/org/sonar/api/utils/MessageException.java
parentadde7cf9216f9a0ccf78409078838d826d816f4a (diff)
downloadsonarqube-3554f0dddfbacee2e11c6c73ca084cfca1d2bb2d.tar.gz
sonarqube-3554f0dddfbacee2e11c6c73ca084cfca1d2bb2d.zip
SONAR-4475 Add method to check that at least one admin exists
Diffstat (limited to 'sonar-plugin-api/src/main/java/org/sonar/api/utils/MessageException.java')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/utils/MessageException.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/utils/MessageException.java b/sonar-plugin-api/src/main/java/org/sonar/api/utils/MessageException.java
index 25290dac9b2..7a703557b5a 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/utils/MessageException.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/utils/MessageException.java
@@ -19,6 +19,14 @@
*/
package org.sonar.api.utils;
+import javax.annotation.CheckForNull;
+import javax.annotation.Nullable;
+
+import java.util.Collection;
+import java.util.Collections;
+
+import static com.google.common.collect.Lists.newArrayList;
+
/**
* Runtime exception for "functional" errors. It aims to be displayed to end-users, without any technical information
* like stack traces.
@@ -27,10 +35,19 @@ package org.sonar.api.utils;
*/
public class MessageException extends RuntimeException {
+ private String l10nKey;
+ private Collection<Object> l10nParams;
+
public MessageException(String s) {
super(s);
}
+ public MessageException(@Nullable String message, @Nullable String l10nKey, @Nullable Object[] l10nParams) {
+ super(message);
+ this.l10nKey = l10nKey;
+ this.l10nParams = l10nParams == null ? Collections.emptyList() : Collections.unmodifiableCollection(newArrayList(l10nParams));
+ }
+
/**
* Does not fill in the stack trace
*
@@ -46,5 +63,14 @@ public class MessageException extends RuntimeException {
return getMessage();
}
+ @CheckForNull
+ public String l10nKey() {
+ return l10nKey;
+ }
+
+ @CheckForNull
+ public Collection<Object> l10nParams() {
+ return l10nParams;
+ }
}