Example usage for javax.ejb EJBException initCause

List of usage examples for javax.ejb EJBException initCause

Introduction

In this page you can find the example usage for javax.ejb EJBException initCause.

Prototype

public synchronized Throwable initCause(Throwable cause) 

Source Link

Document

Initializes the cause of this throwable to the specified value.

Usage

From source file:edu.harvard.iq.dvn.core.study.StudyServiceBean.java

private void copyXMLFile(Study study, File xmlFile, String xmlFileName) {
    try {/*ww w .ja v  a2  s.  c o  m*/
        // create, if needed, the directory
        File newDir = FileUtil.getStudyFileDir(study);
        if (!newDir.exists()) {
            newDir.mkdirs();
        }

        FileUtil.copyFile(xmlFile, new File(newDir, xmlFileName));
    } catch (IOException ex) {
        ex.printStackTrace();
        String msg = "ImportStudy failed: ";
        if (ex.getMessage() != null) {
            msg += ex.getMessage();
        }
        EJBException e = new EJBException(msg);
        e.initCause(ex);
        throw e;
    }
}