
com.adobe.aemforms.fm.exception.FormsMgrException Maven / Gradle / Ivy
/*************************************************************************
*
* ADOBE CONFIDENTIAL
* __________________
*
* Copyright 2012 Adobe Systems Incorporated
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and may be covered by U.S. and Foreign Patents,
* patents in process, and are protected by trade secret or copyright law.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe Systems Incorporated.
**************************************************************************/
package com.adobe.aemforms.fm.exception;
import java.text.MessageFormat;
import java.util.ResourceBundle;
public class FormsMgrException extends Exception {
protected String message;
protected String code;
protected String unresolvedMessage;
protected Object[] messageArgs;
/**
*
*/
private static final long serialVersionUID = 6886411425759527745L;
public FormsMgrException() {
super();
}
public FormsMgrException(String message) {
super(message);
}
public FormsMgrException(Throwable cause) {
super(cause);
}
public FormsMgrException(String message, Throwable cause) {
super(message, cause);
}
public FormsMgrException(String code, Object[] args) {
this(code, args, ResourceBundle.getBundle("errorMessages"));
}
public FormsMgrException(String code, Object[] args, Throwable cause) {
this(code, args, ResourceBundle.getBundle("errorMessages"), cause);
}
public FormsMgrException(String code, Object[] args, ResourceBundle resourceBundle) { //NOSONAR
this.code = code;
this.messageArgs = args;
String messageString = resourceBundle.getString(code);
this.unresolvedMessage = messageString;
if(args != null){
MessageFormat messageFormat = new MessageFormat(messageString);
this.message = messageFormat.format(args);
}
else{
this.message = messageString;
}
}
public FormsMgrException(String code, Object[] args, ResourceBundle resourceBundle, Throwable cause) { //NOSONAR
super(cause);
this.code = code;
this.messageArgs = args;
String messageString = resourceBundle.getString(code);
this.unresolvedMessage = messageString;
if(args != null){
MessageFormat messageFormat = new MessageFormat(messageString);
this.message = messageFormat.format(args);
}
else{
this.message = messageString;
}
}
public String getCode() {
return code;
}
protected void setCode(String code) {
this.code = code;
}
@Override
public String getMessage() {
if(this.message != null) {
return message;
}
return super.getMessage();
}
protected void setMessage(String message) {
this.message = message;
}
public String getUnresolvedMessage() {
return unresolvedMessage;
}
protected void setUnresolvedMessage(String unresolvedMessage) {
this.unresolvedMessage = unresolvedMessage;
}
public Object[] getMessageArgs() {
return messageArgs;
}
protected void setMessageArgs(Object[] messageArgs) { //NOSONAR
this.messageArgs = messageArgs;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy