All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.clickntap.hub.XMLErrorResponse Maven / Gradle / Ivy

There is a newer version: 1.30
Show newest version
package com.clickntap.hub;

import org.springframework.validation.BindException;
import org.springframework.validation.FieldError;

import java.util.ArrayList;
import java.util.List;

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;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy