Example usage for java.lang.reflect InvocationTargetException getCause

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

Introduction

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

Prototype

public Throwable getCause() 

Source Link

Document

Returns the cause of this exception (the thrown target exception, which may be null ).

Usage

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  w  ww .  ja  v a2s.  co 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 {//from w  w w  .  ja  v a 2  s .  com
        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   www. j a  va2 s  . c om
        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 {/*from w  w w . j  a va 2 s .  com*/
        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  a  2 s.c o  m
        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:hudson.jbpm.model.TaskInstanceWrapper.java

public Object getForm() {
    TaskInstance ti = getTaskInstance();
    try {//from   ww w  . j av a  2s  .co  m
        ClassLoader processClassLoader = ProcessClassLoaderCache.INSTANCE
                .getClassLoader(ti.getProcessInstance().getProcessDefinition());
        String formClass = (String) ti.getVariableLocally("form");
        if (formClass == null) {
            return new Form(ti);
        } else {
            Class<?> cl = processClassLoader.loadClass(formClass);
            return cl.getConstructor(TaskInstance.class).newInstance(ti);
        }
    } catch (InvocationTargetException e) {
        throw new RuntimeException(e.getCause());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

}

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 {/*w  w  w.j  a v  a  2  s  .  com*/
        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());
    }
}

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