Example usage for java.lang NoSuchMethodException printStackTrace

List of usage examples for java.lang NoSuchMethodException printStackTrace

Introduction

In this page you can find the example usage for java.lang NoSuchMethodException printStackTrace.

Prototype

public void printStackTrace(PrintStream s) 

Source Link

Document

Prints this throwable and its backtrace to the specified print stream.

Usage

From source file:dk.netarkivet.externalsoftware.HeritrixTests.java

/**
 * Get a list of URLs as calculated by the Heritrix tests.
 *
 * @return The list of URLs.//from w ww .j a v a2  s .com
 */
private URL[] classPathAsURLS() {
    URL[] urls = null;
    try {
        Method method = ReflectUtils.getPrivateMethod(AbstractJMXHeritrixController.class, "updateEnvironment",
                Map.class);
        Map<String, String> environment = new HashMap<String, String>(System.getenv());
        method.invoke(null, environment);
        String[] urlStrings = environment.get("CLASSPATH").split(":");
        urls = new URL[urlStrings.length];
        for (int i = 0; i < urlStrings.length; i++) {
            urls[i] = new URL("file:" + urlStrings[i]);
        }
    } catch (NoSuchMethodException e) {
        e.printStackTrace(System.err);
        fail("Exception " + e.getMessage());
    } catch (IllegalAccessException e) {
        e.printStackTrace(System.err);
        fail("Exception " + e.getMessage());
    } catch (InvocationTargetException e) {
        e.printStackTrace(System.err);
        fail("Exception " + e.getMessage());
    } catch (MalformedURLException e) {
        e.printStackTrace(System.err);
        fail("Exception " + e.getMessage());
    }
    return urls;
}