Example usage for java.lang RuntimeException getMessage

List of usage examples for java.lang RuntimeException getMessage

Introduction

In this page you can find the example usage for java.lang RuntimeException getMessage.

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:com.github.carlomicieli.rest.resources.RollingStocksResource.java

@DELETE
@Path("/{rsId}")
public void delete(@PathParam("rsId") long rsId) {
    log.info("DELETE /rollingstocks/{}", rsId);

    final RollingStock rs = new RollingStock(rsId);

    try {//w  ww  .  ja v  a  2  s  . c  om
        rsService.save(rs);
    } catch (RuntimeException ex) {
        log.error(ex.getMessage());
        throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
    }
}

From source file:cz.fi.muni.pa165.dao.PrintedBookDAOImpl.java

@Override
public PrintedBook findPrintedBookById(long id) {
    try {//from   w ww .  ja v  a  2  s. co m
        final Query query = em.createQuery("SELECT m FROM PrintedBook as m WHERE m.idPrintedBook = :i");
        query.setParameter("i", id);
        return (PrintedBook) query.getSingleResult();
    } catch (RuntimeException E) {
        throw new DAException(E.getMessage());
    }
}

From source file:cz.fi.muni.pa165.dao.PrintedBookDAOImpl.java

@Override
public List<PrintedBook> findAllBorrowedPrintedBooks() {
    try {//from   w w  w . j  av a 2  s .c o m
        final Query query = em.createQuery("SELECT m FROM PrintedBook as m WHERE m.state = :i");
        query.setParameter("i", Boolean.TRUE);
        return query.getResultList();
    } catch (RuntimeException E) {
        throw new DAException(E.getMessage());
    }
}

From source file:cn.suishen.email.mail.store.imap.ImapTempFileLiteral.java

@Override
public void destroy() {
    try {/*from  w  w w  . j ava 2 s .c  o m*/
        if (!isDestroyed() && mFile.exists()) {
            mFile.delete();
        }
    } catch (RuntimeException re) {
        // Just log and ignore.
        Log.w(Logging.LOG_TAG, "Failed to remove temp file: " + re.getMessage());
    }
    super.destroy();
}

From source file:com.emc.ecs.sync.filter.IdLoggingFilter.java

@Override
public synchronized void filter(SyncObject obj) {
    try {//from  w  ww . j ava2s .co m
        getNext().filter(obj);
        out.println(obj.getSourceIdentifier() + ", " + obj.getTargetIdentifier());
    } catch (RuntimeException e) {
        // Log the error
        out.println(obj.getSourceIdentifier() + ", FAILED: " + e.getMessage());
        throw e;
    }
}

From source file:com.github.carlomicieli.rest.resources.RollingStocksResource.java

@PUT
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response put(RollingStockRepresentation rsRep) {
    log.info("PUT /rollingstocks");

    final RollingStock rs = rsRep.getInner();

    try {//from   w  w  w .  j  av a2 s. com
        rsService.save(rs);

        // the response contains the ETag for the resource just created.
        return Response.noContent().tag(rsRep.tag()).build();
    } catch (RuntimeException ex) {
        log.error(ex.getMessage());
        throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
    }
}

From source file:com.github.carlomicieli.rest.resources.RollingStocksResource.java

@POST
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
public Response post(RollingStockRepresentation rsRep) {
    log.info("POST /rollingstocks");

    final RollingStock rs = rsRep.getInner();

    try {//from ww  w  .ja  v a 2s.c o  m
        long id = rsService.create(rs);

        // the response contains the ETag for the resource just created.
        return Response.created(URI.create(Long.toString(id))).tag(rsRep.tag()).build();
    } catch (RuntimeException ex) {
        log.error(ex.getMessage());
        throw new WebApplicationException(Status.INTERNAL_SERVER_ERROR);
    }
}

From source file:cz.fi.muni.pa165.dao.PrintedBookDAOImpl.java

@Override
public void insert(PrintedBook t) {
    if (t == null) {
        throw new IllegalArgumentException("Printed Book null");
    }//from w  ww .  j a  va2  s.c om

    try {
        em.persist(t);
    } catch (RuntimeException E) {
        throw new DAException(E.getMessage());
    }
}

From source file:br.com.livraria.bean.FuncionarioBean.java

public void carregarCadastro() {
    try {// w w  w. j  a  va 2  s . c om
        if (codigo != null) {
            FuncionarioDAO funcionarioDAO = new FuncionarioDAO();
            funcionarioCadastro = funcionarioDAO.buscarPorCodigo(codigo);
        } else {
            funcionarioCadastro = new Funcionario();
        }
    } catch (RuntimeException ex) {
        FacesUtil.adicionarMsgError("Erro ao tentar obter os dados do funcionrio:" + ex.getMessage());
    }
}

From source file:cz.fi.muni.pa165.dao.PrintedBookDAOImpl.java

@Override
public void delete(PrintedBook t) {
    if (t == null) {
        throw new IllegalArgumentException("Printed Book null");
    }/*from w  ww . j a  va  2 s  .c om*/

    try {
        PrintedBook a = em.merge(t);
        em.remove(a);
    } catch (RuntimeException E) {
        throw new DAException(E.getMessage());
    }
}