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:org.anon.exec.AnonExec.java

public void run(AnonymisationMethod anonymisationMethod) {
    try {/*from   w  ww .ja v a2s.c o m*/
        if (executionData == null) {
            createExecution("Run Method Only " + anonymisationMethod);
        }
        do_run(anonymisationMethod);
        execAuditor.executionFinished(executionData);
    } catch (RuntimeException e) {
        execAuditor.executionFailed(executionData, e.getMessage());
        throw e;
    }
}

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

public void excluir() {
    try {//w  w  w  .ja  v  a 2  s. co  m
        FuncionarioDAO funcionarioDAO = new FuncionarioDAO();
        funcionarioDAO.excluir(funcionarioCadastro);

        FacesUtil.adicionarMsgInfo("Funcionrio excluido com sucesso");
    } catch (RuntimeException ex) {
        FacesUtil.adicionarMsgError("Erro ao tentar remover um funcionrio:" + ex.getMessage());
    }
}

From source file:net.sf.authorship.strategies.GitStrategy.java

public Set<Author> getAuthors() throws AuthorshipException {

    try {/*  w ww  .j a v a 2s . c  o  m*/
        this.cloneRepository(this.readOnlyUrl, this.folder);
    } catch (IOException ioe) {
        throw new AuthorshipException("Failed to clone git repository [" + this.readOnlyUrl + "]", ioe);
    }

    final Set<Author> authorEmails = new HashSet<Author>();
    final File directory = new File(this.folder);
    try {
        final Repository repository;
        try {
            repository = RepositoryCache.open(RepositoryCache.FileKey.lenient(directory, FS.DETECTED), true);
        } catch (IOException ioe) {
            throw new AuthorshipException("Failed to open git repository [" + this.readOnlyUrl
                    + "] cloned into local repository [" + this.folder + "]", ioe);
        }

        final RevWalk walk;
        try {
            walk = new RevWalk(repository);
            if (StringUtils.isNotBlank(this.fromRevision)) {
                this.fromRevision = Constants.HEAD;
            }
            ObjectId revId = repository.resolve(this.fromRevision);
            RevCommit root = walk.parseCommit(revId);
            walk.markStart(root);
            if (StringUtils.isNotBlank(this.toRevision)) {
                ObjectId to = repository.resolve(this.toRevision);
                RevCommit end = walk.parseCommit(to);
                walk.markUninteresting(end);
            }
        } catch (IOException ioe) {
            throw new AuthorshipException("Failed to analyse revisions from git repository [" + this.folder
                    + "]: " + ioe.getMessage(), ioe);
        }

        for (RevCommit commit : walk) {
            Author author = new Author(null, commit.getAuthorIdent().getName(),
                    commit.getAuthorIdent().getEmailAddress(), null);
            authorEmails.add(author);
        }
        walk.dispose();
    } finally {
        try {
            if (!directory.delete()) {
                directory.deleteOnExit();
            }
        } catch (RuntimeException re) {
            LOGGER.warning(re.getMessage());
        }
    }

    return authorEmails;
}

From source file:org.fornax.cartridges.sculptor.framework.event.CamelEventBusImpl.java

public boolean unsubscribe(String toTopic, EventSubscriber subscriber) {
    try {//from  www  . j  av a  2  s  .  co  m
        EventListener eventListener = new EventListener(toTopic, subscriber);
        Consumer consumer = null;
        synchronized (listeners) {
            consumer = listeners.get(eventListener);
            listeners.remove(eventListener);
        }
        if (consumer != null) {
            consumer.stop();
        }
    } catch (RuntimeException e) {
        throw e;
    } catch (Exception e) {
        throw new RuntimeException(e.getMessage(), e);
    }
    return true;
}

From source file:org.fornax.cartridges.sculptor.framework.event.CamelEventBusImpl.java

public boolean subscribe(String toTopic, final EventSubscriber subscriber) {
    try {// w  w  w  .  j a  va 2 s  .co m
        Endpoint endpoint = camelContext.getEndpoint(prefixed(toTopic));
        Consumer consumer = endpoint.createConsumer(new org.apache.camel.Processor() {
            public void process(Exchange exchange) throws Exception {
                Event event = (Event) exchange.getIn().getBody();
                subscriber.receive(event);
            }
        });
        camelContext.addService(consumer);
        synchronized (listeners) {
            listeners.put(new EventListener(toTopic, subscriber), consumer);
        }
    } catch (RuntimeException e) {
        throw e;
    } catch (Exception e) {
        throw new RuntimeException(e.getMessage(), e);
    }
    return true;
}

From source file:org.cleverbus.admin.web.msg.MessageOperationController.java

/**
 * The restart method - gets input from web-user and calls a service method
 * for updating the DB record based on the MSG ID.
 * <p/>//from  ww w .j  a v  a 2  s. c o m
 * By default, when the checkbox is on web send as empty = the default value is not annotation driven, but manually
 * setup to false.
 *
 * @param modelMap     default view object for adding data to the view resolver (FTL)
 * @param messageID    user-input form parameter, used in the restart operation
 * @param totalRestart user-input, if the message should be restarted from scratch
 * @return name of the view
 */
@RequestMapping(value = "/restartMessage", method = RequestMethod.POST)
public String restartMessage(@ModelAttribute("model") ModelMap modelMap,
        @RequestParam("messageID") Long messageID,
        @RequestParam(value = "totalRestart", required = false) Boolean totalRestart) {

    if (totalRestart == null) {
        totalRestart = false;
    }

    if (messageID == null) {
        modelMap.addAttribute(RESTART_RESULT_ATTR, OP_NF);
    } else {
        try {
            service.restartMessage(messageID, totalRestart);
            modelMap.addAttribute(RESTART_RESULT_ATTR, RESTART_OK);
        } catch (RuntimeException rex) {
            modelMap.addAttribute(RESTART_RESULT_ATTR, RESTART_NOK + ": " + rex.getMessage());
        }
    }
    return VIEW_NAME;
}

From source file:com.android.email.mail.store.imap.ImapTempFileLiteral.java

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

From source file:com.android.phone.common.mail.store.imap.ImapTempFileLiteral.java

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

From source file:org.anon.exec.AnonExec.java

@Override
public void runAll() {
    tablesProcessed = 0;//  w w  w .  ja  va  2s  . co m

    try {
        if (executionData == null) {
            createExecution("Run All");
        }
        for (AnonymisationMethod anonymisationMethod : execConfig.getAnonMethods()) {
            do_run(anonymisationMethod);
        }
        execAuditor.executionFinished(executionData);
    } catch (RuntimeException e) {
        execAuditor.executionFailed(executionData, e.getMessage());
        throw e;
    }
}

From source file:jenkins.plugins.coverity.CoverityTool.CovCaptureCommandTest.java

@Test
public void customTestCommandTest_WithParseException() throws IOException, InterruptedException {
    TaOptionBlock taOptionBlock = new TaOptionBlockBuilder().withCustomTestCommand("\'").build();
    CoverityPublisher publisher = new CoverityPublisherBuilder().withTaOptionBlock(taOptionBlock).build();

    Command covCaptureCommand = new CovCaptureCommand(build, launcher, listener, publisher, StringUtils.EMPTY,
            envVars);/*from   w w  w. ja v  a 2s. c o m*/
    try {
        covCaptureCommand.runCommand();
        fail("RuntimeException should have been thrown");
    } catch (RuntimeException e) {
        assertEquals("ParseException occurred during tokenizing the cov capture custom test command.",
                e.getMessage());
    }
}