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:com.liferay.util.PropertyComparator.java

public int compare(Object obj1, Object obj2) {
    try {//from   w  ww.j  a  va 2s .  com
        for (int i = 0; i < _propertyNames.length; i++) {
            String propertyName = _propertyNames[i];

            Object property1 = PropertyUtils.getProperty(obj1, propertyName);
            Object property2 = PropertyUtils.getProperty(obj2, propertyName);

            if (property1 instanceof String) {
                int result = property1.toString().compareToIgnoreCase(property2.toString());

                if (result != 0) {
                    return result;
                }
            }

            if (property1 instanceof Comparable) {
                int result = ((Comparable) property1).compareTo(property2);

                if (result != 0) {
                    return result;
                }
            }
        }
    } catch (NoSuchMethodException nsme) {
        Logger.error(this, nsme.getMessage(), nsme);
    } catch (InvocationTargetException ite) {
        Logger.error(this, ite.getMessage(), ite);
    } catch (IllegalAccessException iae) {
        Logger.error(this, iae.getMessage(), iae);
    }

    return -1;
}

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

@Override
public Object call(Object o) throws Exception {
    ;//ww  w.  j  a va  2s  . c  o m
    Method udfMethod = udfClass.getDeclaredMethod(udfMethodName, parameterTypes);
    try {
        if (Modifier.isStatic(udfMethod.getModifiers())) {
            return udfMethod.invoke(null);
        } else {
            Object udfInstance = udfClass.newInstance();
            return udfMethod.invoke(udfInstance);
        }
    } 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.UDF1Adaptor.java

@Override
public Object call(Object o) throws Exception {
    Method udfMethod = udfClass.getDeclaredMethod(udfMethodName, parameterTypes);
    try {//from ww w . j  a  v  a 2  s. co  m
        if (Modifier.isStatic(udfMethod.getModifiers())) {
            return udfMethod.invoke(null, o);
        } else {
            Object udfInstance = udfClass.newInstance();
            return udfMethod.invoke(udfInstance, o);
        }
    } 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.UDF2Adaptor.java

@Override
public Object call(Object o, Object o2) throws Exception {
    Method udfMethod = udfClass.getDeclaredMethod(udfMethodName, parameterTypes);
    try {//from  www  .  j  av  a 2s. c o  m
        if (Modifier.isStatic(udfMethod.getModifiers())) {
            return udfMethod.invoke(null, o, o2);
        } else {
            Object udfInstance = udfClass.newInstance();
            return udfMethod.invoke(udfInstance, o, o2);
        }
    } 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.UDF3Adaptor.java

@Override
public Object call(Object o, Object o2, Object o3) throws Exception {
    Method udfMethod = udfClass.getDeclaredMethod(udfMethodName, parameterTypes);
    try {//w ww  . j ava 2  s .co m
        if (Modifier.isStatic(udfMethod.getModifiers())) {
            return udfMethod.invoke(null, o, o2, o3);
        } else {
            Object udfInstance = udfClass.newInstance();
            return udfMethod.invoke(udfInstance, o, o2, o3);
        }
    } 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.UDF4Adaptor.java

@Override
public Object call(Object o, Object o2, Object o3, Object o4) throws Exception {
    Method udfMethod = udfClass.getDeclaredMethod(udfMethodName, parameterTypes);
    try {//from w w w  .jav  a 2s .co  m
        if (Modifier.isStatic(udfMethod.getModifiers())) {
            return udfMethod.invoke(null, o, o2, o3, o4);
        } else {
            Object udfInstance = udfClass.newInstance();
            return udfMethod.invoke(udfInstance, o, o2, o3, o4);
        }
    } 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.UDF5Adaptor.java

@Override
public Object call(Object o, Object o2, Object o3, Object o4, Object o5) throws Exception {
    Method udfMethod = udfClass.getDeclaredMethod(udfMethodName, parameterTypes);
    try {//ww w. j  a  v a 2  s .c om
        if (Modifier.isStatic(udfMethod.getModifiers())) {
            return udfMethod.invoke(null, o, o2, o3, o4, o5);
        } else {
            Object udfInstance = udfClass.newInstance();
            return udfMethod.invoke(udfInstance, o, o2, o3, o4, o5);
        }
    } 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.UDF6Adaptor.java

@Override
public Object call(Object o, Object o2, Object o3, Object o4, Object o5, Object o6) throws Exception {
    Method udfMethod = udfClass.getDeclaredMethod(udfMethodName, parameterTypes);
    try {// w w  w. ja v a2s  .com
        if (Modifier.isStatic(udfMethod.getModifiers())) {
            return udfMethod.invoke(null, o, o2, o3, o4, o5, o6);
        } else {
            Object udfInstance = udfClass.newInstance();
            return udfMethod.invoke(udfInstance, o, o2, o3, o4, o5, o6);
        }
    } 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:com.espertech.esper.event.bean.BeanEventBeanConfiguredCopyMethod.java

public EventBean copy(EventBean theEvent) {
    Object underlying = theEvent.getUnderlying();
    Object copied;//  w  ww. j a v  a 2 s .  c om
    try {
        copied = copyMethod.invoke(underlying, null);
    } catch (InvocationTargetException e) {
        log.error("InvocationTargetException copying event object for update: " + e.getMessage(), e);
        return null;
    } catch (RuntimeException e) {
        log.error("RuntimeException copying event object for update: " + e.getMessage(), e);
        return null;
    }

    return eventAdapterService.adapterForTypedBean(copied, beanEventType);
}

From source file:org.wso2.carbon.analytics.spark.core.udf.adaptor.UDF10Adaptor.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) throws Exception {
    Method udfMethod = udfClass.getDeclaredMethod(udfMethodName, parameterTypes);
    try {//from   w  w w.j  a  va  2s  . c om
        if (Modifier.isStatic(udfMethod.getModifiers())) {
            return udfMethod.invoke(null, o, o2, o3, o4, o5, o6, o7, o8, o9, o10);
        } else {
            Object udfInstance = udfClass.newInstance();
            return udfMethod.invoke(udfInstance, o, o2, o3, o4, o5, o6, o7, o8, o9, o10);
        }
    } 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());
    }
}