Example usage for java.lang.reflect InvocationTargetException getTargetException

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

Introduction

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

Prototype

public Throwable getTargetException() 

Source Link

Document

Get the thrown target exception.

Usage

From source file:org.apache.axis.AxisProperties.java

public static Object newInstance(final Class spiClass, final Class constructorParamTypes[],
        final Object constructorParams[]) {
    return AccessController.doPrivileged(new PrivilegedAction() {
        public Object run() {
            ResourceClassIterator services = getResourceClassIterator(spiClass);

            Object obj = null;// w  w w .  j a  v  a2  s. c om
            while (obj == null && services.hasNext()) {
                Class service = services.nextResourceClass().loadClass();

                /* service == null
                 * if class resource wasn't loadable
                 */
                if (service != null) {
                    /* OK, class loaded.. attempt to instantiate it.
                     */
                    try {
                        ClassUtils.verifyAncestory(spiClass, service);
                        obj = ClassUtils.newInstance(service, constructorParamTypes, constructorParams);
                    } catch (InvocationTargetException e) {
                        if (e.getTargetException() instanceof java.lang.NoClassDefFoundError) {
                            log.debug(Messages.getMessage("exception00"), e);
                        } else {
                            log.warn(Messages.getMessage("exception00"), e);
                        }
                    } catch (Exception e) {
                        log.warn(Messages.getMessage("exception00"), e);
                    }
                }
            }

            return obj;
        }
    });
}

From source file:org.apache.axis.configuration.EngineConfigurationFactoryFinder.java

private static EngineConfigurationFactory newFactory(Class service, Class[] paramTypes, Object[] param) {
    /**/*from ww  w  .  j  a v a  2  s.  c o  m*/
     * Some JDK's may link on method resolution (findPublicStaticMethod)
     * and others on method call (method.invoke).
     * 
     * Either way, catch class load/resolve problems and return null.
     */

    try {
        /**
         * Verify that service implements:
         *  public static EngineConfigurationFactory newFactory(Object);
         */
        Method method = ClassUtils.findPublicStaticMethod(service, EngineConfigurationFactory.class,
                "newFactory", paramTypes);

        if (method == null) {
            log.warn(Messages.getMessage("engineConfigMissingNewFactory", service.getName(), requiredMethod));
        } else {
            try {
                return (EngineConfigurationFactory) method.invoke(null, param);
            } catch (InvocationTargetException e) {
                if (e.getTargetException() instanceof NoClassDefFoundError) {
                    log.debug(Messages.getMessage("engineConfigLoadFactory", service.getName()));
                } else {
                    log.warn(Messages.getMessage("engineConfigInvokeNewFactory", service.getName(),
                            requiredMethod), e);
                }
            } catch (Exception e) {
                log.warn(Messages.getMessage("engineConfigInvokeNewFactory", service.getName(), requiredMethod),
                        e);
            }
        }
    } catch (NoClassDefFoundError e) {
        log.debug(Messages.getMessage("engineConfigLoadFactory", service.getName()));
    }

    return null;
}

From source file:org.apache.axis.encoding.ser.BeanSerializer.java

/**
 * Serialize a bean.  Done simply by serializing each bean property.
 * @param name is the element name// w ww  .  java  2 s .  com
 * @param attributes are the attributes...serialize is free to add more.
 * @param value is the value
 * @param context is the SerializationContext
 */
public void serialize(QName name, Attributes attributes, Object value, SerializationContext context)
        throws IOException {
    // Check for meta-data in the bean that will tell us if any of the
    // properties are actually attributes, add those to the element
    // attribute list
    Attributes beanAttrs = getObjectAttributes(value, attributes, context);

    // Get the encoding style
    boolean isEncoded = context.isEncoded();

    // check whether we have and xsd:any namespace="##any" type
    boolean suppressElement = !isEncoded && name.getNamespaceURI().equals("")
            && name.getLocalPart().equals("any");

    if (!suppressElement)
        context.startElement(name, beanAttrs);

    // check whether the array is converted to ArrayOfT shema type    
    if (value != null && value.getClass().isArray()) {
        Object newVal = JavaUtils.convert(value, javaType);
        if (newVal != null && javaType.isAssignableFrom(newVal.getClass())) {
            value = newVal;
        }
    }
    try {
        // Serialize each property
        for (int i = 0; i < propertyDescriptor.length; i++) {
            String propName = propertyDescriptor[i].getName();
            if (propName.equals("class"))
                continue;
            QName qname = null;
            QName xmlType = null;
            Class javaType = propertyDescriptor[i].getType();

            boolean isOmittable = false;
            // isNillable default value depends on the field type
            boolean isNillable = Types.isNullable(javaType);
            // isArray
            boolean isArray = false;
            QName itemQName = null;

            // If we have type metadata, check to see what we're doing
            // with this field.  If it's an attribute, skip it.  If it's
            // an element, use whatever qname is in there.  If we can't
            // find any of this info, use the default.
            if (typeDesc != null) {
                FieldDesc field = typeDesc.getFieldByName(propName);
                if (field != null) {
                    if (!field.isElement()) {
                        continue;
                    }

                    ElementDesc element = (ElementDesc) field;

                    // If we're SOAP encoded, just use the local part,
                    // not the namespace.  Otherwise use the whole
                    // QName.
                    if (isEncoded) {
                        qname = new QName(element.getXmlName().getLocalPart());
                    } else {
                        qname = element.getXmlName();
                    }
                    isOmittable = element.isMinOccursZero();
                    isNillable = element.isNillable();
                    isArray = element.isMaxOccursUnbounded();
                    xmlType = element.getXmlType();
                    itemQName = element.getItemQName();
                    context.setItemQName(itemQName);
                }
            }

            if (qname == null) {
                qname = new QName(isEncoded ? "" : name.getNamespaceURI(), propName);
            }

            if (xmlType == null) {
                // look up the type QName using the class
                xmlType = context.getQNameForClass(javaType);
            }

            // Read the value from the property
            if (propertyDescriptor[i].isReadable()) {
                if (itemQName != null || (!propertyDescriptor[i].isIndexed() && !isArray)) {
                    // Normal case: serialize the value
                    Object propValue = propertyDescriptor[i].get(value);

                    if (propValue == null) {
                        // an element cannot be null if nillable property is set to
                        // "false" and the element cannot be omitted
                        if (!isNillable && !isOmittable) {
                            if (Number.class.isAssignableFrom(javaType)) {
                                // If we have a null and it's a number, though,
                                // we might turn it into the appropriate kind of 0.
                                // TODO : Should be caching these constructors?
                                try {
                                    Constructor constructor = javaType
                                            .getConstructor(SimpleDeserializer.STRING_CLASS);
                                    propValue = constructor.newInstance(ZERO_ARGS);
                                } catch (Exception e) {
                                    // If anything goes wrong here, oh well we tried.
                                }
                            }

                            if (propValue == null) {
                                throw new IOException(Messages.getMessage("nullNonNillableElement", propName));
                            }
                        }

                        // if meta data says minOccurs=0, then we can skip
                        // it if its value is null and we aren't doing SOAP
                        // encoding.
                        if (isOmittable && !isEncoded) {
                            continue;
                        }
                    }

                    context.serialize(qname, null, propValue, xmlType, javaType);
                } else {
                    // Collection of properties: serialize each one
                    int j = 0;
                    while (j >= 0) {
                        Object propValue = null;
                        try {
                            propValue = propertyDescriptor[i].get(value, j);
                            j++;
                        } catch (Exception e) {
                            j = -1;
                        }
                        if (j >= 0) {
                            context.serialize(qname, null, propValue, xmlType, propertyDescriptor[i].getType());
                        }
                    }
                }
            }
        }

        BeanPropertyDescriptor anyDesc = typeDesc == null ? null : typeDesc.getAnyDesc();
        if (anyDesc != null) {
            // If we have "extra" content here, it'll be an array
            // of MessageElements.  Serialize each one.
            Object anyVal = anyDesc.get(value);
            if (anyVal != null && anyVal instanceof MessageElement[]) {
                MessageElement[] anyContent = (MessageElement[]) anyVal;
                for (int i = 0; i < anyContent.length; i++) {
                    MessageElement element = anyContent[i];
                    element.output(context);
                }
            }
        }
    } catch (InvocationTargetException ite) {
        Throwable target = ite.getTargetException();
        log.error(Messages.getMessage("exception00"), target);
        throw new IOException(target.toString());
    } catch (Exception e) {
        log.error(Messages.getMessage("exception00"), e);
        throw new IOException(e.toString());
    }

    if (!suppressElement)
        context.endElement();
}

From source file:org.apache.axis.transport.http.AxisServlet.java

/**
 * Attempts to invoke a plugin for the query string supplied in the URL.
 *
 * @param request the servlet's HttpServletRequest object.
 * @param response the servlet's HttpServletResponse object.
 * @param writer the servlet's PrintWriter object.
 *//* ww  w  . ja  v a 2 s  .  co m*/

private boolean processQuery(HttpServletRequest request, HttpServletResponse response, PrintWriter writer)
        throws AxisFault {
    // Attempt to instantiate a plug-in handler class for the query string
    // handler classes defined in the HTTP transport.

    String path = request.getServletPath();
    String queryString = request.getQueryString();
    String serviceName;
    AxisEngine engine = getEngine();
    Iterator i = this.transport.getOptions().keySet().iterator();

    if (queryString == null) {
        return false;
    }

    String servletURI = request.getContextPath() + path;
    String reqURI = request.getRequestURI();
    // chop off '/'.
    if (servletURI.length() + 1 < reqURI.length()) {
        serviceName = reqURI.substring(servletURI.length() + 1);
    } else {
        serviceName = "";
    }
    while (i.hasNext() == true) {
        String queryHandler = (String) i.next();

        if (queryHandler.startsWith("qs.") == true) {
            // Only attempt to match the query string with transport
            // parameters prefixed with "qs:".

            String handlerName = queryHandler.substring(queryHandler.indexOf(".") + 1).toLowerCase();

            // Determine the name of the plugin to invoke by using all text
            // in the query string up to the first occurence of &, =, or the
            // whole string if neither is present.

            int length = 0;
            boolean firstParamFound = false;

            while (firstParamFound == false && length < queryString.length()) {
                char ch = queryString.charAt(length++);

                if (ch == '&' || ch == '=') {
                    firstParamFound = true;

                    --length;
                }
            }

            if (length < queryString.length()) {
                queryString = queryString.substring(0, length);
            }

            if (queryString.toLowerCase().equals(handlerName) == true) {
                // Query string matches a defined query string handler name.

                // If the defined class name for this query string handler is blank,
                // just return (the handler is "turned off" in effect).

                if (this.transport.getOption(queryHandler).equals("")) {
                    return false;
                }

                try {
                    // Attempt to dynamically load the query string handler
                    // and its "invoke" method.

                    MessageContext msgContext = createMessageContext(engine, request, response);
                    Class plugin = Class.forName((String) this.transport.getOption(queryHandler));
                    Method pluginMethod = plugin.getDeclaredMethod("invoke",
                            new Class[] { msgContext.getClass() });
                    String url = HttpUtils.getRequestURL(request).toString();

                    // Place various useful servlet-related objects in
                    // the MessageContext object being delivered to the
                    // plugin.
                    msgContext.setProperty(MessageContext.TRANS_URL, url);
                    msgContext.setProperty(HTTPConstants.PLUGIN_SERVICE_NAME, serviceName);
                    msgContext.setProperty(HTTPConstants.PLUGIN_NAME, handlerName);
                    msgContext.setProperty(HTTPConstants.PLUGIN_IS_DEVELOPMENT, new Boolean(isDevelopment()));
                    msgContext.setProperty(HTTPConstants.PLUGIN_ENABLE_LIST, new Boolean(enableList));
                    msgContext.setProperty(HTTPConstants.PLUGIN_ENGINE, engine);
                    msgContext.setProperty(HTTPConstants.PLUGIN_WRITER, writer);
                    msgContext.setProperty(HTTPConstants.PLUGIN_LOG, log);
                    msgContext.setProperty(HTTPConstants.PLUGIN_EXCEPTION_LOG, exceptionLog);

                    // Invoke the plugin.

                    pluginMethod.invoke(plugin.newInstance(), new Object[] { msgContext });

                    writer.close();

                    return true;
                } catch (InvocationTargetException ie) {
                    reportTroubleInGet(ie.getTargetException(), response, writer);
                    // return true to prevent any further processing
                    return true;
                } catch (Exception e) {
                    reportTroubleInGet(e, response, writer);
                    // return true to prevent any further processing
                    return true;
                }
            }
        }
    }

    return false;
}

From source file:org.apache.cactus.internal.client.ClientTestCaseCaller.java

/**
 * Call a begin method which takes Cactus WebRequest as parameter.
 *
 * @param theRequest the request object which will contain data that will
 *        be used to connect to the Cactus server side redirectors.
 * @param theMethodName the name of the begin method to call
 * @exception Throwable any error that occurred when calling the method
 */// w  w w  . ja  v  a  2 s.  co  m
private void callGenericBeginMethod(Request theRequest, String theMethodName) throws Throwable {
    // First, verify if a begin method exist. If one is found, verify if
    // it has the correct signature. If not, send a warning.
    Method[] methods = getTest().getClass().getMethods();

    for (int i = 0; i < methods.length; i++) {
        if (methods[i].getName().equals(theMethodName)) {
            TestCaseImplementChecker.checkAsBeginMethod(methods[i]);

            try {
                methods[i].invoke(getTest(), new Object[] { theRequest });

                break;
            } catch (InvocationTargetException e) {
                e.fillInStackTrace();
                throw e.getTargetException();
            } catch (IllegalAccessException e) {
                e.fillInStackTrace();
                throw e;
            }
        }
    }
}

From source file:org.apache.click.util.ClickUtils.java

/**
 * Invoke the named method on the given target object and return the result.
 *
 * @param target the target object with the method to invoke
 * @param method the name of the method to invoke
 * @return Object the target method result
 *//*w  ww.  j  av a2s  .  c o  m*/
private static Object invokeMethod(Object target, String method) {
    if (target == null) {
        throw new IllegalArgumentException("Null target parameter");
    }
    if (method == null) {
        throw new IllegalArgumentException("Null method parameter");
    }

    Method targetMethod = null;
    boolean isAccessible = true;
    try {
        Class<?> targetClass = target.getClass();
        targetMethod = targetClass.getMethod(method);

        // Change accessible for anonymous inner classes public methods
        // only. Conditional checks:
        // #1 - Target method is not accessible
        // #2 - Anonymous inner classes are not public
        // #3 - Only modify public methods
        // #4 - Anonymous inner classes have no declaring class
        // #5 - Anonymous inner classes have $ in name
        if (!targetMethod.isAccessible() && !Modifier.isPublic(targetClass.getModifiers())
                && Modifier.isPublic(targetMethod.getModifiers()) && targetClass.getDeclaringClass() == null
                && targetClass.getName().indexOf('$') != -1) {

            isAccessible = false;
            targetMethod.setAccessible(true);
        }

        return targetMethod.invoke(target);

    } catch (InvocationTargetException ite) {

        Throwable e = ite.getTargetException();
        if (e instanceof RuntimeException) {
            throw (RuntimeException) e;

        } else if (e instanceof Exception) {
            String msg = "Exception occurred invoking public method: " + targetMethod;

            throw new RuntimeException(msg, e);

        } else if (e instanceof Error) {
            String msg = "Error occurred invoking public method: " + targetMethod;

            throw new RuntimeException(msg, e);

        } else {
            String msg = "Error occurred invoking public method: " + targetMethod;

            throw new RuntimeException(msg, e);
        }

    } catch (Exception e) {
        String msg = "Exception occurred invoking public method: " + targetMethod;

        throw new RuntimeException(msg, e);

    } finally {
        if (targetMethod != null && !isAccessible) {
            targetMethod.setAccessible(false);
        }
    }
}

From source file:org.apache.cocoon.components.flow.java.JavaInterpreter.java

/**
 * Calls a Java function, passing <code>params</code> as its
 * arguments. In addition to this, it makes available the parameters
 * through the <code>cocoon.parameters</code> Java array
 * (indexed by the parameter names).//from w w  w . j  a  va  2s . c o  m
 *
 * @param function a <code>String</code> value
 * @param params a <code>List</code> value
 * @param redirector
 * @exception Exception if an error occurs
 */
public void callFunction(String function, List params, Redirector redirector) throws Exception {

    if (!initialized)
        initialize();

    Method method = (Method) methods.get(function);

    if (method == null) {
        throw new ProcessingException("No method '" + function + "' found. " + methods);
    }

    if (getLogger().isDebugEnabled())
        getLogger().debug("calling method \"" + method + "\"");

    Request request = ContextHelper.getRequest(this.avalonContext);
    Session session = request.getSession(true);
    HashMap userScopes = (HashMap) session.getAttribute(USER_GLOBAL_SCOPE);
    if (userScopes == null)
        userScopes = new HashMap();

    Continuable flow = (Continuable) userScopes.get(method.getDeclaringClass());

    ContinuationContext context = new ContinuationContext();
    context.setObject(flow);
    context.setMethod(method);
    context.setAvalonContext(avalonContext);
    context.setLogger(getLogger());
    context.setServiceManager(manager);
    context.setRedirector(redirector);
    Parameters parameters = new Parameters();
    for (Iterator i = params.iterator(); i.hasNext();) {
        Argument argument = (Argument) i.next();
        parameters.setParameter(argument.name, argument.value);
    }
    context.setParameters(parameters);

    Continuation continuation = new Continuation(context);

    WebContinuation wk = continuationsMgr.createWebContinuation(continuation, null, timeToLive,
            getInterpreterID(), null);
    FlowHelper.setWebContinuation(ContextHelper.getObjectModel(this.avalonContext), wk);

    continuation.registerThread();
    try {
        if (flow == null) {
            if (getLogger().isDebugEnabled())
                getLogger().debug("create new instance of \"" + method.getDeclaringClass() + "\"");

            flow = (Continuable) method.getDeclaringClass().newInstance();
            context.setObject(flow);
        }

        method.invoke(flow, new Object[0]);

    } catch (InvocationTargetException ite) {
        if (ite.getTargetException() != null) {
            if (ite.getTargetException() instanceof Exception)
                throw (Exception) ite.getTargetException();
            else if (ite.getTargetException() instanceof Error)
                throw new ProcessingException("An internal error occured", ite.getTargetException());
            else if (ite.getTargetException() instanceof RuntimeException)
                throw (RuntimeException) ite.getTargetException();
            else
                throw ite;
        } else {
            throw ite;
        }
    } finally {
        // remove last object reference, which is not needed to
        // reconstruct the invocation path
        if (continuation.isCapturing())
            continuation.getStack().popReference();
        continuation.deregisterThread();
    }
    userScopes.put(method.getDeclaringClass(), flow);
    session.setAttribute(USER_GLOBAL_SCOPE, userScopes);
}

From source file:org.apache.cocoon.components.flow.java.JavaInterpreter.java

public void handleContinuation(String id, List params, Redirector redirector) throws Exception {
    if (!initialized)
        initialize();//  w ww  .ja v a  2  s  .c o m

    WebContinuation parentwk = continuationsMgr.lookupWebContinuation(id, getInterpreterID());

    if (parentwk == null) {
        /*
         * Throw an InvalidContinuationException to be handled inside the
         * <map:handle-errors> sitemap element.
         */
        throw new InvalidContinuationException("The continuation ID " + id + " is invalid.");
    }

    Continuation parentContinuation = (Continuation) parentwk.getContinuation();
    ContinuationContext parentContext = (ContinuationContext) parentContinuation.getContext();
    ContinuationContext context = new ContinuationContext();
    context.setObject(parentContext.getObject());
    context.setMethod(parentContext.getMethod());
    context.setAvalonContext(avalonContext);
    context.setLogger(getLogger());
    context.setServiceManager(manager);
    context.setRedirector(redirector);
    Parameters parameters = new Parameters();
    for (Iterator i = params.iterator(); i.hasNext();) {
        Argument argument = (Argument) i.next();
        parameters.setParameter(argument.name, argument.value);
    }
    context.setParameters(parameters);

    Continuation continuation = new Continuation(parentContinuation, context);

    Request request = ContextHelper.getRequest(this.avalonContext);
    Session session = request.getSession(true);
    HashMap userScopes = (HashMap) session.getAttribute(USER_GLOBAL_SCOPE);

    Continuable flow = (Continuable) context.getObject();
    Method method = context.getMethod();

    WebContinuation wk = continuationsMgr.createWebContinuation(continuation, parentwk, timeToLive,
            getInterpreterID(), null);
    FlowHelper.setWebContinuation(ContextHelper.getObjectModel(this.avalonContext), wk);

    continuation.registerThread();
    try {

        method.invoke(flow, new Object[0]);

    } catch (InvocationTargetException ite) {
        if (ite.getTargetException() != null) {
            if (ite.getTargetException() instanceof Exception)
                throw (Exception) ite.getTargetException();
            else if (ite.getTargetException() instanceof Error)
                throw new ProcessingException("An internal error occured", ite.getTargetException());
            else if (ite.getTargetException() instanceof RuntimeException)
                throw (RuntimeException) ite.getTargetException();
            else
                throw ite;
        } else {
            throw ite;
        }
    } finally {
        // remove last object reference, which is not needed to reconstruct
        // the invocation path
        if (continuation.isCapturing())
            continuation.getStack().popReference();
        continuation.deregisterThread();
    }

    userScopes.put(method.getDeclaringClass(), flow);
    session.setAttribute(USER_GLOBAL_SCOPE, userScopes);
}

From source file:org.apache.cxf.common.logging.LogUtils.java

/**
 * Create a logger//w  w w .  j  a v a 2  s . c o  m
 */
protected static Logger createLogger(Class<?> cls, String name, String loggerName) {
    ClassLoader orig = getContextClassLoader();
    ClassLoader n = getClassLoader(cls);
    if (n != null) {
        setContextClassLoader(n);
    }
    String bundleName = name;
    try {
        Logger logger = null;
        ResourceBundle b = null;
        if (bundleName == null) {
            //grab the bundle prior to the call to Logger.getLogger(...) so the
            //ResourceBundle can be loaded outside the big sync block that getLogger really is
            bundleName = BundleUtils.getBundleName(cls);
            try {
                b = BundleUtils.getBundle(cls);
            } catch (MissingResourceException rex) {
                //ignore
            }
        } else {
            bundleName = BundleUtils.getBundleName(cls, bundleName);
            try {
                b = BundleUtils.getBundle(cls, bundleName);
            } catch (MissingResourceException rex) {
                //ignore
            }
        }
        if (b != null) {
            b.getLocale();
        }

        if (loggerClass != null) {
            try {
                Constructor<?> cns = loggerClass.getConstructor(String.class, String.class);
                if (name == null) {
                    try {
                        return (Logger) cns.newInstance(loggerName, bundleName);
                    } catch (InvocationTargetException ite) {
                        if (ite.getTargetException() instanceof MissingResourceException) {
                            return (Logger) cns.newInstance(loggerName, null);
                        } else {
                            throw ite;
                        }
                    }
                } else {
                    try {
                        return (Logger) cns.newInstance(loggerName, bundleName);
                    } catch (InvocationTargetException ite) {
                        if (ite.getTargetException() instanceof MissingResourceException) {
                            throw (MissingResourceException) ite.getTargetException();
                        } else {
                            throw ite;
                        }
                    }
                }
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }

        try {
            logger = Logger.getLogger(loggerName, bundleName); //NOPMD
        } catch (IllegalArgumentException iae) {
            //likely a mismatch on the bundle name, just return the default
            logger = Logger.getLogger(loggerName); //NOPMD
        } catch (MissingResourceException rex) {
            logger = Logger.getLogger(loggerName); //NOPMD
        } finally {
            b = null;
        }
        return logger;
    } finally {
        if (n != orig) {
            setContextClassLoader(orig);
        }
    }
}

From source file:org.apache.ddlutils.util.CallbackClosure.java

/**
 * {@inheritDoc}/* www  .  ja  v  a2 s  . c  om*/
 */
public void execute(Object obj) throws DdlUtilsException {
    LinkedList queue = new LinkedList();

    queue.add(obj.getClass());
    while (!queue.isEmpty()) {
        Class type = (Class) queue.removeFirst();
        Method callback = (Method) _callbacks.get(type);

        if (callback != null) {
            try {
                _parameters[_callbackTypePos] = obj;
                callback.invoke(_callee, _parameters);
                return;
            } catch (InvocationTargetException ex) {
                throw new DdlUtilsException(ex.getTargetException());
            } catch (IllegalAccessException ex) {
                throw new DdlUtilsException(ex);
            }
        }
        if ((type.getSuperclass() != null) && !type.getSuperclass().equals(Object.class)) {
            queue.add(type.getSuperclass());
        }

        Class[] baseInterfaces = type.getInterfaces();

        if (baseInterfaces != null) {
            for (int idx = 0; idx < baseInterfaces.length; idx++) {
                queue.add(baseInterfaces[idx]);
            }
        }
    }
}