Example usage for java.lang.reflect InvocationTargetException getMessage

List of usage examples for java.lang.reflect InvocationTargetException getMessage

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:org.sonar.ide.eclipse.ui.internal.wizards.ServerLocationWizardPage.java

private void createTestConnectionButton(Composite container) {
    Button testConnectionButton = new Button(container, SWT.PUSH);
    testConnectionButton.setText(Messages.ServerLocationWizardPage_action_test);
    testConnectionButton.setToolTipText(Messages.ServerLocationWizardPage_action_test_tooltip);
    testConnectionButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

    testConnectionButton.addSelectionListener(new SelectionAdapter() {

        @Override// w  w w  . j a  v  a 2s. c o  m
        public void widgetSelected(SelectionEvent e) {
            // We need those variables - in other case we would get an IllegalAccessException
            final String serverUrl = getServerUrl();
            final String username = getUsername();
            final String password = getPassword();
            try {
                ServerConnectionTestJob testJob = new ServerConnectionTestJob(username, password, serverUrl);
                getWizard().getContainer().run(true, true, testJob);
                status = testJob.getStatus();
            } catch (InvocationTargetException e1) {
                LoggerFactory.getLogger(getClass()).error(e1.getMessage(), e1);
                status = new Status(IStatus.ERROR, SonarUiPlugin.PLUGIN_ID,
                        Messages.ServerLocationWizardPage_msg_error);
            } catch (InterruptedException e1) {
                LoggerFactory.getLogger(getClass()).error(e1.getMessage(), e1);
                status = new Status(IStatus.ERROR, SonarUiPlugin.PLUGIN_ID,
                        Messages.ServerLocationWizardPage_msg_error);
            } catch (OperationCanceledException e1) {
                status = Status.CANCEL_STATUS;
            }
            getWizard().getContainer().updateButtons();

            String message = status.getMessage();
            switch (status.getSeverity()) {
            case IStatus.OK:
                setMessage(message, IMessageProvider.INFORMATION);
                break;
            default:
                setMessage(message, IMessageProvider.ERROR);
                break;
            }
        }
    });
}

From source file:org.openadaptor.auxil.processor.map.AttributeMapProcessor.java

protected Object cloneMap(Map incoming) {
    if (incoming instanceof IOrderedMap) {
        return ((IOrderedMap) incoming).clone();
    }//  w ww .j  a  va  2s .c  om
    if (incoming instanceof MapFacade) {
        return ((MapFacade) incoming).clone();
    }
    if (incoming instanceof HashMap) {
        return ((HashMap) incoming).clone();
    }
    try {
        Method cloneMethod = incoming.getClass().getMethod(mapCloneMethod, (Class[]) null);
        return (cloneMethod.invoke(incoming, (Object[]) null));
    } catch (NoSuchMethodException nsme) {
        log.warn("Unable to find clone method  " + mapCloneMethod + "(). " + nsme.getMessage());
    } catch (InvocationTargetException ite) {
        log.warn("Unable to invoke clone method " + mapCloneMethod + "(). " + ite.getMessage());
    } catch (IllegalAccessException iae) {
        log.warn("Failed to invoke clone method " + mapCloneMethod + "(). " + iae.getMessage());
    }
    log.warn("Unable to clone incoming map - the original might get modified!");
    return incoming;
}

From source file:com.ciphertool.zodiacengine.genetic.algorithms.BasicGeneticAlgorithmTest.java

@Test
public void testSpawnInitialPopulation() {
    List<Chromosome> individualsBefore = new ArrayList<Chromosome>();
    int originalSize = population.size();
    for (int i = 0; i < originalSize; i++) {
        ((SolutionChromosome) population.getIndividuals().get(0)).setId(new BigInteger(String.valueOf(i)));
        individualsBefore.add(population.removeIndividual(0));
    }//from w  w w . ja va2 s . c om

    assertEquals(population.size(), 0);
    assertEquals(geneticAlgorithm.getPopulation().size(), 0);

    try {
        invokeMethod(geneticAlgorithm, "initialize", null, null);
    } catch (InvocationTargetException e) {
        fail(e.getMessage());
    }

    assertEquals(population.size(), POPULATION_SIZE);

    for (Chromosome individual : population.getIndividuals()) {
        // Make sure each individual has been evaluated
        assertTrue(individual.getFitness() > 0.0);

        // Make sure each individual is new
        for (Chromosome individualBefore : individualsBefore) {
            assertFalse(individual == individualBefore);
        }
    }
}

From source file:gov.nih.nci.ncicb.tcga.dcc.datareports.dao.jdbc.ProjectCaseDashboardDAOImpl.java

protected String processOverallProgress(final ProjectCase pc) {
    final int targetCase = Integer.parseInt(pc.getProjectedCaseBCR());
    int totalColumns = requiredMethodNames.size();
    double totalRatio = 0;
    String overallRatio = "";
    try {// w  w w.j  a  va2s . c o  m
        for (final Method method : projectCaseClassMethods) {
            if (requiredMethodNames.contains(method.getName())) {
                final String result = (String) method.invoke(pc);
                if (NA.equals(result)) {
                    totalColumns--;
                } else {
                    totalRatio += getRatio(result);
                }
            }
        }
        totalRatio = totalRatio / totalColumns;
        overallRatio = Math.round(totalRatio * targetCase) + "/" + targetCase;

    } catch (IllegalAccessException ie) {
        logger.error(ie.getMessage(), ie);
    } catch (InvocationTargetException ive) {
        logger.error(ive.getMessage(), ive);
    }

    return overallRatio;
}

From source file:org.vulpe.controller.filter.VulpeFilterDispatcher.java

/**
 * Filter with URL Rewriter.//  www. j ava2s  .co m
 *
 * @param request
 * @param response
 * @param chain
 * @param url
 * @return
 * @throws IOException
 * @throws ServletException
 */
private boolean doFilterURLRewrite(final ServletRequest request, final ServletResponse response,
        final FilterChain chain, final String url) throws IOException, ServletException {
    final HttpServletRequest hsRequest = (HttpServletRequest) request;
    final HttpServletResponse hsResponse = (HttpServletResponse) response;
    boolean rewrite = false;
    for (final Rule rule : (List<Rule>) URL_REWRITER.getConf().getRules()) {
        try {
            final RewrittenUrl rewrittenUrl = rule.matches(url, hsRequest, hsResponse);
            if (rewrittenUrl != null) {
                rewrite = true;
                URL_REWRITE_FILTER.doFilter(hsRequest, hsResponse, chain);
                break;
            }
        } catch (InvocationTargetException e) {
            LOG.error(e.getMessage());
        }
    }
    return rewrite;
}

From source file:com.lp.server.util.logger.HvDtoLogger.java

public void logInsert(T value1) {
    cachedBaseId = null;/*from  w ww . j a v a 2  s .co  m*/
    operationMode = "INSERT";

    try {
        Object value2 = Class.forName(value1.getClass().getName()).getConstructor().newInstance();
        logImpl(value1, value2);
    } catch (InvocationTargetException e) {
        System.out.println("Invocation " + e.getMessage());
    } catch (IllegalAccessException e) {
        System.out.println("IllegalAccess " + e.getMessage());
    } catch (InstantiationException e) {
        System.out.println("Instantiation " + e.getMessage());
    } catch (NoSuchMethodException e) {
        System.out.println("NoSuchMethod " + e.getMessage());
    } catch (ClassNotFoundException e) {
        System.out.println("ClassNotFound " + e.getMessage());
    }
}

From source file:com.myjeeva.poi.ExcelWorkSheetHandler.java

private void assignValue(Object targetObj, String cellReference, String value) {
    if (null == targetObj || StringUtils.isEmpty(cellReference) || StringUtils.isEmpty(value)) {
        return;// ww w  .  j  a v  a  2s  . co m
    }

    try {
        String propertyName = this.cellMapping.get(cellReference);
        if (null == propertyName) {
            LOG.error("Cell mapping doesn't exists!");
        } else {
            PropertyUtils.setSimpleProperty(targetObj, propertyName, value);
        }
    } catch (IllegalAccessException iae) {
        LOG.error(iae.getMessage());
    } catch (InvocationTargetException ite) {
        LOG.error(ite.getMessage());
    } catch (NoSuchMethodException nsme) {
        LOG.error(nsme.getMessage());
    }
}

From source file:com.myjeeva.poi.ExcelWorkSheetHandler.java

private String getPropertyValue(Object targetObj, String propertyName) {
    String value = "";
    if (null == targetObj || StringUtils.isBlank(propertyName)) {
        LOG.error("targetObj or propertyName is null, both require to retrieve a value");
        return value;
    }/*from w w  w.  jav a2  s .c om*/

    try {
        if (PropertyUtils.isReadable(targetObj, propertyName)) {
            Object v = PropertyUtils.getSimpleProperty(targetObj, propertyName);
            if (null != v && StringUtils.isNotBlank(v.toString())) {
                value = v.toString();
            }
        } else {
            LOG.error("Given property (" + propertyName + ") is not readable!");
        }
    } catch (IllegalAccessException iae) {
        LOG.error(iae.getMessage());
    } catch (InvocationTargetException ite) {
        LOG.error(ite.getMessage());
    } catch (NoSuchMethodException nsme) {
        LOG.error(nsme.getMessage());
    }
    return value;
}

From source file:com.krawler.br.nodes.Activity.java

@Override
synchronized public void invoke() throws ProcessException {
    KwlLoader loader = operation.getEntityLoader();
    if (loader == null)
        throw new ProcessException("No loader available for entity " + operation.getEntityName());
    Object obj = loader.load(operation.getEntityName());
    if (obj == null)
        throw new ProcessException(
                "Entity not found [" + operation.getEntityName() + "] for operation :" + operation.getName());
    try {/*  ww w  .ja v a 2 s  . c  om*/
        Object res = MethodUtils.invokeMethod(obj, operation.getMethodName(), getParams());
        if (operation.getOutputParameter() != null) {
            heap.put(operation.getOutputParameter().getName(), res);
        }
    } catch (InvocationTargetException ex) {
        throw new ProcessException(ex.getCause().getMessage(), ex.getCause());
    } catch (NoSuchMethodException ex) {
        throw new ProcessException(ex.getMessage(), ex);
    } catch (IllegalAccessException ex) {
        throw new ProcessException(ex.getMessage(), ex);
    }
}

From source file:com.all.tracker.controllers.DownloadMetricsController.java

public <T> T setFeatures(String[] features, Class<T> clazz)
        throws InstantiationException, IllegalAccessException {
    if (clazz == null || features == null || features.length == 0) {
        log.error("exception when try to create a SyncAble entity");
        return null;
    }//from  ww  w.  jav  a  2 s .c om
    T obj = clazz.newInstance();
    for (String item : features) {
        String[] feature = splitMetrics(item, charset_inside);
        if (feature.length == 2) {
            if (PropertyUtils.isWriteable(obj, feature[0])) {
                try {
                    PropertyUtils.setProperty(obj, feature[0], feature[1]);
                } catch (InvocationTargetException e) {
                    log.error(e.getMessage());
                } catch (NoSuchMethodException e) {
                    log.error(e.getMessage());
                }
            }
        }
    }
    return obj;
}