Example usage for javax.ejb EJBException getClass

List of usage examples for javax.ejb EJBException getClass

Introduction

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

Prototype

@HotSpotIntrinsicCandidate
public final native Class<?> getClass();

Source Link

Document

Returns the runtime class of this Object .

Usage

From source file:ru.codeinside.gses.manager.ManagerService.java

public Procedure createProcedure(String name, String description, String serviceId, Long code, String login,
        ProcedureType type) {//from www  .  jav  a  2 s .c  om
    try {
        if (hasProcedureWithSameRegisterCode(code)) {
            throw new RuntimeException(
                    " ?    ??");
        }
        final Procedure procedure = new Procedure();
        mergeProcedure(procedure, name, description, serviceId, code, type);
        procedure.setCreator(em.find(Employee.class, login));
        em.persist(procedure);
        return procedure;
    } catch (EJBException e) {
        final String message;
        if (e.getMessage() != null) {
            message = e.getMessage();
        } else if (e.getCausedByException() != null) {
            message = e.getCausedByException().getMessage();
        } else {
            message = e.getCause() != null ? e.getCause().getMessage() : e.getClass().toString();
        }
        throw new RuntimeException(message);
    }
}