[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
This commit is contained in:
parent
a1a3f7ffba
commit
f0f593c956
@ -5,16 +5,24 @@ package org.bukkit.plugin;
|
|||||||
*/
|
*/
|
||||||
public class InvalidDescriptionException extends Exception {
|
public class InvalidDescriptionException extends Exception {
|
||||||
private static final long serialVersionUID = 5721389122281775894L;
|
private static final long serialVersionUID = 5721389122281775894L;
|
||||||
private final Throwable cause;
|
|
||||||
private final String message;
|
/**
|
||||||
|
* Constructs a new InvalidDescriptionException based on the given Exception
|
||||||
|
*
|
||||||
|
* @param message Brief message explaining the cause of the exception
|
||||||
|
* @param cause Exception that triggered this Exception
|
||||||
|
*/
|
||||||
|
public InvalidDescriptionException(final Throwable cause, final String message) {
|
||||||
|
super(message + (cause != null ? ": " + cause.getMessage() : ""), cause);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new InvalidDescriptionException based on the given Exception
|
* Constructs a new InvalidDescriptionException based on the given Exception
|
||||||
*
|
*
|
||||||
* @param throwable Exception that triggered this Exception
|
* @param throwable Exception that triggered this Exception
|
||||||
*/
|
*/
|
||||||
public InvalidDescriptionException(Throwable throwable) {
|
public InvalidDescriptionException(final Throwable cause) {
|
||||||
this(throwable, "Invalid plugin.yml");
|
this(cause, "Invalid plugin.yml");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -26,36 +34,10 @@ public class InvalidDescriptionException extends Exception {
|
|||||||
this(null, message);
|
this(null, 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 Throwable throwable, final String message) {
|
|
||||||
this.cause = null;
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new InvalidDescriptionException
|
* Constructs a new InvalidDescriptionException
|
||||||
*/
|
*/
|
||||||
public InvalidDescriptionException() {
|
public InvalidDescriptionException() {
|
||||||
this(null, "Invalid plugin.yml");
|
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -5,31 +5,20 @@ package org.bukkit.plugin;
|
|||||||
*/
|
*/
|
||||||
public class InvalidPluginException extends Exception {
|
public class InvalidPluginException extends Exception {
|
||||||
private static final long serialVersionUID = -8242141640709409542L;
|
private static final long serialVersionUID = -8242141640709409542L;
|
||||||
private final Throwable cause;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new InvalidPluginException based on the given Exception
|
* 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) {
|
public InvalidPluginException(final Throwable cause) {
|
||||||
cause = throwable;
|
super("Invalid plugin" + (cause != null ? ": " + cause.getMessage() : ""), cause);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new InvalidPluginException
|
* Constructs a new InvalidPluginException
|
||||||
*/
|
*/
|
||||||
public InvalidPluginException() {
|
public InvalidPluginException() {
|
||||||
cause = null;
|
this(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;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user