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.wso2.carbon.analytics.spark.core.udf.adaptor.UDF18Adaptor.java

@Override
public Object call(Object o, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7, Object o8,
        Object o9, Object o10, Object o11, Object o12, Object o13, Object o14, Object o15, Object o16,
        Object o17, Object o18) throws Exception {
    Method udfMethod = udfClass.getDeclaredMethod(udfMethodName, parameterTypes);
    try {// w  ww.j  a v  a 2 s.c  o  m
        if (Modifier.isStatic(udfMethod.getModifiers())) {
            return udfMethod.invoke(null, o, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16,
                    o17, o18);
        } else {
            Object udfInstance = udfClass.newInstance();
            return udfMethod.invoke(udfInstance, o, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14,
                    o15, o16, o17, o18);
        }
    } catch (InvocationTargetException e) {
        log.error("Error while invoking method: " + udfMethodName + ", " + e.getMessage(), e.getCause());
        throw new Exception("Error while invoking method: " + udfMethodName + ", " + e.getMessage(),
                e.getCause());
    }
}

From source file:org.wso2.carbon.analytics.spark.core.udf.adaptor.UDF19Adaptor.java

@Override
public Object call(Object o, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7, Object o8,
        Object o9, Object o10, Object o11, Object o12, Object o13, Object o14, Object o15, Object o16,
        Object o17, Object o18, Object o19) throws Exception {
    Method udfMethod = udfClass.getDeclaredMethod(udfMethodName, parameterTypes);
    try {/*w w w  .  j a  v a 2  s.  c  o  m*/
        if (Modifier.isStatic(udfMethod.getModifiers())) {
            return udfMethod.invoke(null, o, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16,
                    o17, o18, o19);
        } else {
            Object udfInstance = udfClass.newInstance();
            return udfMethod.invoke(udfInstance, o, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14,
                    o15, o16, o17, o18, o19);
        }
    } catch (InvocationTargetException e) {
        log.error("Error while invoking method: " + udfMethodName + ", " + e.getMessage(), e.getCause());
        throw new Exception("Error while invoking method: " + udfMethodName + ", " + e.getMessage(),
                e.getCause());
    }
}

From source file:org.wso2.carbon.analytics.spark.core.udf.adaptor.UDF20Adaptor.java

@Override
public Object call(Object o, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7, Object o8,
        Object o9, Object o10, Object o11, Object o12, Object o13, Object o14, Object o15, Object o16,
        Object o17, Object o18, Object o19, Object o20) throws Exception {
    Method udfMethod = udfClass.getDeclaredMethod(udfMethodName, parameterTypes);
    try {/*w w  w.java  2  s. c  o  m*/
        if (Modifier.isStatic(udfMethod.getModifiers())) {
            return udfMethod.invoke(null, o, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16,
                    o17, o18, o19, o20);
        } else {
            Object udfInstance = udfClass.newInstance();
            return udfMethod.invoke(udfInstance, o, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14,
                    o15, o16, o17, o18, o19, o20);
        }
    } catch (InvocationTargetException e) {
        log.error("Error while invoking method: " + udfMethodName + ", " + e.getMessage(), e.getCause());
        throw new Exception("Error while invoking method: " + udfMethodName + ", " + e.getMessage(),
                e.getCause());
    }
}

From source file:org.wso2.carbon.analytics.spark.core.udf.adaptor.UDF21Adaptor.java

@Override
public Object call(Object o, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7, Object o8,
        Object o9, Object o10, Object o11, Object o12, Object o13, Object o14, Object o15, Object o16,
        Object o17, Object o18, Object o19, Object o20, Object o21) throws Exception {
    Method udfMethod = udfClass.getDeclaredMethod(udfMethodName, parameterTypes);
    try {/*from w  w w  .ja  v a  2 s .  c  o m*/
        if (Modifier.isStatic(udfMethod.getModifiers())) {
            return udfMethod.invoke(null, o, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16,
                    o17, o18, o19, o20, o21);
        } else {
            Object udfInstance = udfClass.newInstance();
            return udfMethod.invoke(udfInstance, o, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14,
                    o15, o16, o17, o18, o19, o20, o21);
        }
    } catch (InvocationTargetException e) {
        log.error("Error while invoking method: " + udfMethodName + ", " + e.getMessage(), e.getCause());
        throw new Exception("Error while invoking method: " + udfMethodName + ", " + e.getMessage(),
                e.getCause());
    }
}

From source file:org.wso2.carbon.analytics.spark.core.udf.adaptor.UDF22Adaptor.java

@Override
public Object call(Object o, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7, Object o8,
        Object o9, Object o10, Object o11, Object o12, Object o13, Object o14, Object o15, Object o16,
        Object o17, Object o18, Object o19, Object o20, Object o21, Object o22) throws Exception {
    Method udfMethod = udfClass.getDeclaredMethod(udfMethodName, parameterTypes);
    try {/*from   w  w w. j a va 2 s.  c o m*/
        if (Modifier.isStatic(udfMethod.getModifiers())) {
            return udfMethod.invoke(null, o, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14, o15, o16,
                    o17, o18, o19, o20, o21, o22);
        } else {
            Object udfInstance = udfClass.newInstance();
            return udfMethod.invoke(udfInstance, o, o2, o3, o4, o5, o6, o7, o8, o9, o10, o11, o12, o13, o14,
                    o15, o16, o17, o18, o19, o20, o21, o22);
        }
    } catch (InvocationTargetException e) {
        log.error("Error while invoking method: " + udfMethodName + ", " + e.getMessage(), e.getCause());
        throw new Exception("Error while invoking method: " + udfMethodName + ", " + e.getMessage(),
                e.getCause());
    }
}

From source file:ShowProgress.java

/**
 * Creates the main window's contents/*from  w  w  w .j a  v  a 2s  . c om*/
 * 
 * @param parent the main window
 * @return Control
 */
protected Control createContents(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(1, true));

    // Create the indeterminate checkbox
    final Button indeterminate = new Button(composite, SWT.CHECK);
    indeterminate.setText("Indeterminate");

    // Create the ShowProgress button
    Button showProgress = new Button(composite, SWT.NONE);
    showProgress.setText("Show Progress");

    final Shell shell = parent.getShell();

    // Display the ProgressMonitorDialog
    showProgress.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            try {
                new ProgressMonitorDialog(shell).run(true, true,
                        new LongRunningOperation(indeterminate.getSelection()));
            } catch (InvocationTargetException e) {
                MessageDialog.openError(shell, "Error", e.getMessage());
            } catch (InterruptedException e) {
                MessageDialog.openInformation(shell, "Cancelled", e.getMessage());
            }
        }
    });

    parent.pack();
    return composite;
}

From source file:org.apache.hadoop.hbase.thrift.HbaseHandlerMetricsProxy.java

@Override
public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
    Object result;/*from ww w .ja va2  s.c o m*/
    try {
        long start = now();
        result = m.invoke(handler, args);
        long processTime = now() - start;
        metrics.incMethodTime(m.getName(), processTime);
    } catch (InvocationTargetException e) {
        throw e.getTargetException();
    } catch (Exception e) {
        throw new RuntimeException("unexpected invocation exception: " + e.getMessage());
    }
    return result;
}

From source file:lius.index.mixedindexing.MixedIndexer.java

/**
 * Retourne une collection contenant les champs avec les valeurs  indexer
 * comme par exemple: le texte integrale, titre etc. <br/><br/>Returns a
 * collection containing the fieds with the values to index, like : full
 * text, title, etc./*  w w  w .  j  a va2  s .c  o m*/
 */

public Collection getPopulatedLiusFields() {
    List populatedList = new ArrayList();
    List indexers = IndexerFactory.getIndexers(getMixedContentsObj(), getLiusConfig());
    for (int i = 0; i < indexers.size(); i++) {
        Indexer indexer = (Indexer) indexers.get(i);
        if (indexer != null) {
            if ((indexer.isConfigured()) && (indexer.getType() == Indexer.INDEXER_CONFIG_FIELDS_COL)) {
                Iterator cit = getConfigurationFields().iterator();
                while (cit.hasNext()) {
                    LiusField mf = (LiusField) cit.next();
                    if (indexer.getMimeType().equals(mf.getFileMimeType())) {
                        Collection populCollFile = indexer.getPopulatedLiusFields();
                        if (indexer.getDocToIndexPath() != null) {
                            LiusField lff = new LiusField();
                            lff.setName("path");
                            String path = indexer.getDocToIndexPath();
                            lff.setValue(path);
                            lff.setType("Keyword");
                            populCollFile.add(lff);
                        }

                        Iterator it = populCollFile.iterator();
                        LiusField f = null;
                        LiusField newLF = null;
                        while (it.hasNext()) {
                            Object o = it.next();
                            try {
                                if (o instanceof LiusField) {
                                    f = (LiusField) o;
                                    newLF = new LiusField();
                                    BeanUtils.copyProperties(newLF, f);
                                    populatedList.add(newLF);
                                }
                            } catch (InvocationTargetException ex) {
                                logger.error(ex.getMessage());
                            } catch (IllegalAccessException ex) {
                                logger.error(ex.getMessage());
                            }
                        }
                    }
                }
            }
        }
    }
    return populatedList;

}

From source file:org.kuali.coeus.common.budget.framework.query.operator.RelationalOperator.java

/**Compares this object with the specified object for order.
 *Returns a negative integer, zero, or a positive integer as this object
 *is less than, equal to, or greater than the specified object.
 *///  w  w w. j  a v a 2s  .  c  om
protected int compare(Object baseBean) {
    int compareValue = 0;

    if (dataClass == null || !dataClass.equals(baseBean.getClass())) {

        dataClass = baseBean.getClass();

        try {
            field = dataClass.getDeclaredField(fieldName);
            if (!field.isAccessible()) {
                throw new NoSuchFieldException();
            }
        } catch (NoSuchFieldException noSuchFieldException) {
            try {
                String methodName = "";

                if (isBoolean) {
                    methodName = "is" + (fieldName.charAt(0) + "").toUpperCase() + fieldName.substring(1);
                } else {
                    methodName = "get" + (fieldName.charAt(0) + "").toUpperCase() + fieldName.substring(1);
                }
                method = dataClass.getMethod(methodName, null);
            } catch (NoSuchMethodException noSuchMethodException) {
                LOG.error(noSuchMethodException.getMessage(), noSuchMethodException);
            }
        }
    } //End if field==null && method==null

    try {
        if (field != null && field.isAccessible()) {

            if (!isBoolean) {
                Comparable comparable = (Comparable) field.get(baseBean);
                if (comparable == null && fixedData == null) {
                    compareValue = 0;
                } else if (comparable == null) {
                    throw new UnsupportedOperationException();
                } else {
                    compareValue = comparable.compareTo(fixedData);
                }

            } else {
                if (((Boolean) field.get(baseBean)).booleanValue() == booleanFixedData)
                    compareValue = 0;
                else
                    compareValue = 1;
            }
        } else {
            if (!isBoolean) {
                Comparable comparable = (Comparable) method.invoke(baseBean, null);
                if (comparable == null && fixedData == null) {
                    compareValue = 0;
                } else if (comparable == null) {
                    throw new UnsupportedOperationException();
                } else if (comparable != null && fixedData == null) {
                    compareValue = -1;
                } else {
                    compareValue = comparable.compareTo(fixedData);
                }
            } else {
                Boolean booleanObj = (Boolean) method.invoke(baseBean, null);
                if (booleanObj == null) {
                    compareValue = -1;
                } else {
                    if (booleanObj.booleanValue() == booleanFixedData)
                        compareValue = 0;
                    else
                        compareValue = 1;
                }
            }
        }
    } catch (IllegalAccessException illegalAccessException) {
        LOG.error(illegalAccessException.getMessage(), illegalAccessException);
    } catch (InvocationTargetException invocationTargetException) {
        LOG.error(invocationTargetException.getMessage(), invocationTargetException);
    }
    return compareValue;
}

From source file:no.sesat.search.datamodel.DataModelFactoryImplTest.java

/** Calls the method.invoke(..) wrapping any thrown exceptions with a RuntimeException. **/
private Object invoke(final Method method, final Object dataObject, final Object... args) {

    try {/*ww w  .ja va2s. com*/
        return method.invoke(dataObject, args);

    } catch (IllegalAccessException iae) {
        LOG.error(iae.getMessage(), iae);
        throw new RuntimeException(iae.getMessage(), iae);
    } catch (IllegalArgumentException iae) {
        LOG.info(iae.getMessage(), iae);
        throw new RuntimeException(iae.getMessage(), iae);
    } catch (InvocationTargetException ite) {
        LOG.info(ite.getMessage(), ite);
        throw new RuntimeException(ite.getMessage(), ite);
    }
}