Skip to content
Snippets Groups Projects

Iss #71 - Clean up magic numbers in common lib

Merged Martin Lowe requested to merge malowe/eclipsefdn-api-common:malowe/main/71 into main
18 files
+ 346
234
Compare changes
  • Side-by-side
  • Inline
Files
18
@@ -11,6 +11,8 @@
@@ -11,6 +11,8 @@
**********************************************************************/
**********************************************************************/
package org.eclipsefoundation.core.exception;
package org.eclipsefoundation.core.exception;
 
import javax.ws.rs.core.Response.Status;
 
/**
/**
* A custom exception used as a wrapper to handle basic runtime exceptions.
* A custom exception used as a wrapper to handle basic runtime exceptions.
*/
*/
@@ -19,19 +21,18 @@ public class ApplicationException extends RuntimeException {
@@ -19,19 +21,18 @@ public class ApplicationException extends RuntimeException {
private final Integer statusCode;
private final Integer statusCode;
/**
/**
* Instantiate an ApplicationException with a message. 500 Status is assumed.
* Instantiate an ApplicationException with a message. HttpStatus.SC_INTERNAL_SERVER_ERROR Status is assumed.
*
*
* @param message the message to display
* @param message the message to display
*/
*/
public ApplicationException(String message) {
public ApplicationException(String message) {
this(message, 500);
this(message, Status.INTERNAL_SERVER_ERROR.getStatusCode());
}
}
/**
/**
* Instantiate an ApplicationException with a message and http response status
* Instantiate an ApplicationException with a message and http response status code.
* code.
*
*
* @param message the message to display
* @param message the message to display
* @param statusCode The status code to return to the client
* @param statusCode The status code to return to the client
*/
*/
public ApplicationException(String message, Integer statusCode) {
public ApplicationException(String message, Integer statusCode) {
@@ -40,22 +41,21 @@ public class ApplicationException extends RuntimeException {
@@ -40,22 +41,21 @@ public class ApplicationException extends RuntimeException {
}
}
/**
/**
* Instantiate an ApplicationException with a message and a cause. Status 500 is
* Instantiate an ApplicationException with a message and a cause. Status HttpStatus.SC_INTERNAL_SERVER_ERROR is
* assumed.
* assumed.
*
*
* @param message the message to display
* @param message the message to display
* @param cause The cause of the error
* @param cause The cause of the error
*/
*/
public ApplicationException(String message, Throwable cause) {
public ApplicationException(String message, Throwable cause) {
this(message, cause, 500);
this(message, cause, Status.INTERNAL_SERVER_ERROR.getStatusCode());
}
}
/**
/**
* Instantiate an ApplicationException with a message, http response code, and a
* Instantiate an ApplicationException with a message, http response code, and a cause;
* cause;
*
*
* @param message the message to display
* @param message the message to display
* @param cause The cause of the error
* @param cause The cause of the error
* @param statusCode The status code to return to the client
* @param statusCode The status code to return to the client
*/
*/
public ApplicationException(String message, Throwable cause, Integer statusCode) {
public ApplicationException(String message, Throwable cause, Integer statusCode) {
Loading