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:edu.chalmers.dat076.moviefinder.service.FileThreadServiceImpl.java

@Override
public void newFile(Path path) {
    LOGGER.info("newFile: " + path);
    try {/* w  w  w  .java2  s.c  o m*/
        movieDatabaseHelper.saveFile(path);
    } catch (RuntimeException e) {
        LOGGER.info(e.getMessage());
    }
}

From source file:org.opentestsystem.ap.ivs.rest.ExceptionAdvice.java

@ExceptionHandler(RuntimeException.class)
public ResponseEntity<List<ErrorMessage>> handleInternalServerError(final RuntimeException ex) {
    log.error("Internal server error", ex);
    return generateResponse(ex.getMessage(), INTERNAL_SERVER_ERROR);
}

From source file:com.qubole.quark.server.EndToEndTest.java

@Test
public void testClient() throws SQLException, ClassNotFoundException, InterruptedException {
    Class.forName("com.qubole.quark.jdbc.QuarkDriver");
    Class.forName("org.h2.Driver");
    Connection connection = null;

    // Due to threading, server might not be up.
    for (int i = 0; i < 2; i++) {
        try {//from   w  w w  .j av a 2s.  c  om
            connection = DriverManager.getConnection(ThinClientUtil.getConnectionUrl("0.0.0.0", 8765),
                    new Properties());
        } catch (RuntimeException e) {
            if (e.getMessage().contains("Connection refused")) {
                Thread.sleep(2000);
            } else {
                throw new RuntimeException(e);
            }
        }
    }

    String query = "select * from canonical.public.web_returns";
    ResultSet resultSet = connection.createStatement().executeQuery(query);

    List<String> wrItemSk = new ArrayList<String>();
    List<String> wrOrderNumber = new ArrayList<String>();
    while (resultSet.next()) {
        wrItemSk.add(resultSet.getString("wr_item_sk"));
        wrOrderNumber.add(resultSet.getString("wr_order_number"));
    }

    assertThat(wrItemSk.size(), equalTo(1));
    assertThat(wrOrderNumber.size(), equalTo(1));
    assertThat(wrItemSk.get(0), equalTo("1"));
    assertThat(wrOrderNumber.get(0), equalTo("10"));
}

From source file:edu.chalmers.dat076.moviefinder.service.FileThreadServiceImpl.java

@Override
public void initFiles(List<Path> paths, Path basePath) {
    LOGGER.info("initFiles: " + paths.size());
    try {/*from w  w  w .ja va 2s  .  co  m*/
        movieDatabaseHelper.updateFiles(paths, basePath);
    } catch (RuntimeException e) {
        LOGGER.info(e.getMessage());
    }

}

From source file:br.com.sigcopex.bean.AutenticacaoBean.java

public String autenticar() {
    try {/*from  w w  w.j  a v a 2s . com*/
        UsuarioDAO usuarioDAO = new UsuarioDAO();
        usuarioLogado = usuarioDAO.autenticar(usuarioLogado.getCpf(),
                DigestUtils.md5Hex(usuarioLogado.getSenha()));
        usuarioAtivo = usuarioLogado;
        if (usuarioLogado == null) {
            FacesUtil.adicionarMsgError("CPF e/ou senha invlido(s)");
            return null;
        } else {
            FacesUtil.adicionarMsgInfo("Usurio autenticado com sucesso: " + usuarioLogado.getNome());
            return "/pages/principal.xhtml?faces-redirect=true";
        }

    } catch (RuntimeException ex) {
        FacesUtil.adicionarMsgError("Erro ao tentar autenticar no sistema: " + ex.getMessage());
        return null;
    }

}

From source file:com.thoughtworks.go.domain.FileHandlerTest.java

@Test
public void shouldNotDisplayArtifactMultipleTimesWhenRetriesCalled() throws IOException {
    when(checksums.md5For("src/file/path")).thenReturn("wrong_md5");
    fileHandler.useArtifactMd5Checksums(checksums);

    int retryCount = 0;

    while (retryCount < 2) {
        retryCount++;/*from   w w w  .  j  ava2 s.  c  om*/
        try {
            fileHandler.handle(new ByteArrayInputStream("Hello world".getBytes()));
            fileHandler.handleResult(200, goPublisher);
            fail("Should throw exception when checksums do not match.");
        } catch (RuntimeException e) {
            assertThat(e.getMessage(), is("Artifact download failed for [src/file/path]"));
            assertThat(goPublisher.getMessage(), containsString(
                    "[ERROR] Verification of the integrity of the artifact [src/file/path] failed. The artifact file on the server may have changed since its original upload."));
        }
    }
}

From source file:com.thoughtworks.go.domain.ArtifactMd5ChecksumsTest.java

@Test
public void shouldThrowAnExceptionIfTheLoadingFails() throws IOException {
    try {//from w  w  w.j a va  2  s.  c  o  m
        file.delete();
        new ArtifactMd5Checksums(file);
        fail("Should have failed because of an invalid properites file");
    } catch (RuntimeException e) {
        assertThat(e.getCause(), instanceOf(IOException.class));
        assertThat(e.getMessage(), is(String
                .format("[Checksum Verification] Could not load the MD5 from the checksum file '%s'", file)));
    }
}

From source file:org.jugvale.peoplemanagement.client.service.RESTPersonService.java

private void handle(java.lang.RuntimeException e, Consumer<String> onFail) {
    e.printStackTrace();/*from w  w w . ja va 2  s.c om*/
    onFail.accept("Error: " + e.getMessage() + "; Exception: " + e.getClass().getSimpleName());
}

From source file:com.intuit.autumn.web.InputStreamHttpServletRequestWrapperTest.java

@Test
public void testGetInputStreamSetReadListenerDetail() throws Exception {
    ServletInputStream is = inputStreamHttpServletRequestWrapper.getInputStream();

    try {/*from   w ww  .ja v a2  s  .  c  om*/
        is.setReadListener(readListener);
    } catch (RuntimeException e) {
        assertThat(e.getMessage(), is("Not implemented"));
    }
}

From source file:com.sun.faces.lifecycle.InvokeApplicationPhase.java

public void execute(FacesContext facesContext) throws FacesException {

    if (log.isDebugEnabled()) {
        log.debug("Entering InvokeApplicationsPhase");
    }/*from www  .j  a v a  2  s. c o m*/

    UIViewRoot root = facesContext.getViewRoot();
    Util.doAssert(null != root);

    try {
        root.processApplication(facesContext);
    } catch (RuntimeException re) {
        String exceptionMessage = re.getMessage();
        if (null != exceptionMessage) {
            if (log.isErrorEnabled()) {
                log.error(exceptionMessage, re);
            }
        }
        throw new FacesException(exceptionMessage, re);
    }

    if (log.isDebugEnabled()) {
        log.debug("Exiting InvokeApplicationsPhase");
    }
}