diff options
author | Zeerix <zeerix@draig.de> | 2012-02-11 02:16:16 +0100 |
---|---|---|
committer | EvilSeph <evilseph@gmail.com> | 2012-02-13 01:05:18 -0500 |
commit | f0f593c95612ccd2a54b57e539b61f3dc9e80b51 (patch) | |
tree | 866b51b0b16a082e9a73555c6e3932f6628f1f6d /src/main/java/org | |
parent | a1a3f7ffbaff612c91d0e95abd5a40832c244c43 (diff) | |
download | bukkit-f0f593c95612ccd2a54b57e539b61f3dc9e80b51.tar bukkit-f0f593c95612ccd2a54b57e539b61f3dc9e80b51.tar.gz bukkit-f0f593c95612ccd2a54b57e539b61f3dc9e80b51.tar.lz bukkit-f0f593c95612ccd2a54b57e539b61f3dc9e80b51.tar.xz bukkit-f0f593c95612ccd2a54b57e539b61f3dc9e80b51.zip |
[Bleeding] Cleanup of exceptions org.bukkit.plugin.Invalid*
Removed throwable and message, because the superclass already stores them
Added message of inner exception to the outer exception to make the first line of the stacktrace more verbose
Diffstat (limited to 'src/main/java/org')
-rw-r--r-- | src/main/java/org/bukkit/plugin/InvalidDescriptionException.java | 40 | ||||
-rw-r--r-- | src/main/java/org/bukkit/plugin/InvalidPluginException.java | 19 |
2 files changed, 15 insertions, 44 deletions
diff --git a/src/main/java/org/bukkit/plugin/InvalidDescriptionException.java b/src/main/java/org/bukkit/plugin/InvalidDescriptionException.java index c2de542c..ee787f7b 100644 --- a/src/main/java/org/bukkit/plugin/InvalidDescriptionException.java +++ b/src/main/java/org/bukkit/plugin/InvalidDescriptionException.java @@ -5,36 +5,33 @@ package org.bukkit.plugin; */ public class InvalidDescriptionException extends Exception { private static final long serialVersionUID = 5721389122281775894L; - private final Throwable cause; - private final String message; /** * Constructs a new InvalidDescriptionException based on the given Exception * - * @param throwable Exception that triggered this Exception + * @param message Brief message explaining the cause of the exception + * @param cause Exception that triggered this Exception */ - public InvalidDescriptionException(Throwable throwable) { - this(throwable, "Invalid plugin.yml"); + public InvalidDescriptionException(final Throwable cause, final String message) { + super(message + (cause != null ? ": " + cause.getMessage() : ""), cause); } /** - * Constructs a new InvalidDescriptionException with the given message + * Constructs a new InvalidDescriptionException based on the given Exception * - * @param message Brief message explaining the cause of the exception + * @param throwable Exception that triggered this Exception */ - public InvalidDescriptionException(final String message) { - this(null, message); + public InvalidDescriptionException(final Throwable cause) { + this(cause, "Invalid plugin.yml"); } /** - * Constructs a new InvalidDescriptionException based on the given Exception + * Constructs a new InvalidDescriptionException with the given message * * @param message Brief message explaining the cause of the exception - * @param throwable Exception that triggered this Exception */ - public InvalidDescriptionException(final Throwable throwable, final String message) { - this.cause = null; - this.message = message; + public InvalidDescriptionException(final String message) { + this(null, message); } /** @@ -43,19 +40,4 @@ public class InvalidDescriptionException extends Exception { public InvalidDescriptionException() { this(null, "Invalid plugin.yml"); } - - /** - * If applicable, returns the Exception that triggered this Exception - * - * @return Inner exception, or null if one does not exist - */ - @Override - public Throwable getCause() { - return cause; - } - - @Override - public String getMessage() { - return message; - } } diff --git a/src/main/java/org/bukkit/plugin/InvalidPluginException.java b/src/main/java/org/bukkit/plugin/InvalidPluginException.java index 033ff922..c4736140 100644 --- a/src/main/java/org/bukkit/plugin/InvalidPluginException.java +++ b/src/main/java/org/bukkit/plugin/InvalidPluginException.java @@ -5,31 +5,20 @@ package org.bukkit.plugin; */ public class InvalidPluginException extends Exception { private static final long serialVersionUID = -8242141640709409542L; - private final Throwable cause; /** * Constructs a new InvalidPluginException based on the given Exception * - * @param throwable Exception that triggered this Exception + * @param cause Exception that triggered this Exception */ - public InvalidPluginException(Throwable throwable) { - cause = throwable; + public InvalidPluginException(final Throwable cause) { + super("Invalid plugin" + (cause != null ? ": " + cause.getMessage() : ""), cause); } /** * Constructs a new InvalidPluginException */ public InvalidPluginException() { - cause = null; - } - - /** - * If applicable, returns the Exception that triggered this Exception - * - * @return Inner exception, or null if one does not exist - */ - @Override - public Throwable getCause() { - return cause; + this(null); } } |