Example usage for java.lang Exception getCause

List of usage examples for java.lang Exception getCause

Introduction

In this page you can find the example usage for java.lang Exception getCause.

Prototype

public synchronized Throwable getCause() 

Source Link

Document

Returns the cause of this throwable or null if the cause is nonexistent or unknown.

Usage

From source file:com.nandhootoo.services.NoteServiceImpl.java

public void persist(Note note) {
    EntityTransaction tx = null;/*from  ww w  .  ja v  a  2  s.c  o  m*/
    try {
        entityManager.persist(note);
    } catch (Exception ex) {
        if (tx != null && tx.isActive())
            tx.rollback();
        throw (RuntimeException) ex.getCause();
    }
}

From source file:com.nandhootoo.services.NoteServiceImpl.java

public void merge(Note note) {
    EntityTransaction tx = null;/* ww w .  ja v  a2s . c o m*/
    try {
        entityManager.merge(note);
    } catch (Exception ex) {
        if (tx != null && tx.isActive())
            tx.rollback();
        throw (RuntimeException) ex.getCause();
    }
}

From source file:com.nandhootoo.services.ProductServiceImpl.java

public void persist(Product product) {
    EntityTransaction tx = null;//from w w w . ja  v a2 s .c o  m
    try {
        entityManager.persist(product);
    } catch (Exception ex) {
        if (tx != null && tx.isActive())
            tx.rollback();
        throw (RuntimeException) ex.getCause();
    }
}

From source file:com.nandhootoo.services.ProductServiceImpl.java

public void merge(Product product) {
    EntityTransaction tx = null;/*from w w w  .j a va2s  .co  m*/
    try {
        entityManager.merge(product);
    } catch (Exception ex) {
        if (tx != null && tx.isActive())
            tx.rollback();
        throw (RuntimeException) ex.getCause();
    }
}

From source file:com.nandhootoo.services.StatusServiceImpl.java

public void persist(Status status) {
    EntityTransaction tx = null;//from   ww  w . ja v  a  2s.  c  om
    try {
        entityManager.persist(status);
    } catch (Exception ex) {
        if (tx != null && tx.isActive())
            tx.rollback();
        throw (RuntimeException) ex.getCause();
    }
}

From source file:com.nandhootoo.services.StatusServiceImpl.java

public void merge(Status status) {
    EntityTransaction tx = null;/*from  w  w  w.j  a v  a  2  s. c om*/
    try {
        entityManager.merge(status);
    } catch (Exception ex) {
        if (tx != null && tx.isActive())
            tx.rollback();
        throw (RuntimeException) ex.getCause();
    }
}

From source file:com.nandhootoo.services.UserServiceImpl.java

public void persist(User user) {
    EntityTransaction tx = null;/*from  w  w w . ja  v  a2s .c o  m*/
    try {
        entityManager.persist(user);
    } catch (Exception ex) {
        if (tx != null && tx.isActive())
            tx.rollback();
        throw (RuntimeException) ex.getCause();
    }
}

From source file:com.nandhootoo.services.UserServiceImpl.java

public void merge(User user) {
    EntityTransaction tx = null;/*w w w.j a  v  a 2s  . co m*/
    try {
        entityManager.merge(user);
    } catch (Exception ex) {
        if (tx != null && tx.isActive())
            tx.rollback();
        throw (RuntimeException) ex.getCause();
    }
}

From source file:eu.liveGov.libraries.livegovtoolkit.helper.PermissionHelper.java

@Override
public void webcallReady(HttpResponse response) {
    if (response != null && response.getStatusLine().getStatusCode() == 200) {
        try {//from  w  w w  .j a  va 2 s.  c o m
            Gson gson = new Gson();
            JsonReader jr = new JsonReader(new InputStreamReader(response.getEntity().getContent()));

            PermissionObject[] objects = gson.fromJson(jr, PermissionObject[].class);
            Permissions result = new Permissions();
            result.setPermissions(new ArrayList<PermissionObject>(Arrays.asList(objects)));

            if (result.getPermissions().size() > 0) {
                PermissionHelper.savePermissions(_context, result);
            } else {
                logger.error("Application doesn't have any permissions.");
            }
            PermissionHelper.permissionsUpdated(result);
        } catch (Exception e) {
            logger.error("webcallReady; Exception: {}", e.getCause());
            PermissionHelper.permissionsUpdated(null);
        }
    } else {
        if (response == null) {
            logger.error("webcallReady;  No internet");
        } else {
            logger.error("webcallReady; http statuscode: {}", response.getStatusLine().getStatusCode());
        }
        PermissionHelper.permissionsUpdated(null);
    }
    PermissionHelper.isDownloading = false;
}

From source file:pl.bristleback.server.bristle.action.exception.handler.ActionExceptionHandlers.java

private Exception getRealCause(Exception exception) {
    if (exception instanceof InvocationTargetException) {
        return (Exception) exception.getCause();
    }/*from  ww w . j  av a2  s. c  o m*/
    return exception;
}