Code example for InvocationTargetException

Methods: printStackTrace

0
            Method m = c.getDeclaredMethod("encode", STRING_ARGS_2);
            try { 
                result = (String) m.invoke(null, new Object[] {s, encoding});
            } 
            catch (InvocationTargetException e) {
                e.printStackTrace();
            } 
            catch (IllegalAccessException e) {
                e.printStackTrace();
            } 
        } 
        catch (NoSuchMethodException e) {
            // we're running on JRE 1.3.1 so this is the best we have... 
            result = URLEncoder.encode(s);
        } 
        return result;
    } 
 
}