com.clickntap.hub.XMLErrorResponse Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Stripecube Show documentation
Show all versions of Stripecube Show documentation
Stripecube is an open source Java framework for Web Applications
package com.clickntap.hub;
import java.util.ArrayList;
import java.util.List;
import org.springframework.validation.BindException;
import org.springframework.validation.FieldError;
public class XMLErrorResponse extends BO {
public Throwable exception;
public String stackTrace;
private List errorCodes;
public List getErrorCodes() {
return errorCodes;
}
public void setErrorCodes(List errorCodes) {
this.errorCodes = errorCodes;
}
public Throwable getException() {
return exception;
}
public void setException(Throwable throwable) {
this.exception = throwable;
if (throwable instanceof BindException) {
BindException e = (BindException) throwable;
List errorCodes = new ArrayList();
for (FieldError error : (List) e.getFieldErrors()) {
errorCodes.add(error.getField() + "." + error.getCode());
}
setErrorCodes(errorCodes);
}
}
public String getStackTrace() {
return stackTrace;
}
public void setStackTrace(String stackTrace) {
this.stackTrace = stackTrace;
}
}