Example usage for java.lang IllegalAccessException printStackTrace

List of usage examples for java.lang IllegalAccessException printStackTrace

Introduction

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

Prototype

public void printStackTrace() 

Source Link

Document

Prints this throwable and its backtrace to the standard error stream.

Usage

From source file:TwoStopsGradient.java

public static void main(String... args) {
    try {/*  w w  w . j  a v  a2s .co  m*/
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
    } catch (IllegalAccessException ex) {
        ex.printStackTrace();
    } catch (InstantiationException ex) {
        ex.printStackTrace();
    } catch (UnsupportedLookAndFeelException ex) {
        ex.printStackTrace();
    } catch (ClassNotFoundException ex) {
        ex.printStackTrace();
    }

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            new TwoStopsGradient().setVisible(true);
        }
    });
}

From source file:Main.java

public static int[] getStaticFieldIntArraySafely(Field field) {
    try {/*from  www.  j  a va2s  . c o m*/
        return (int[]) field.get(null);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
    return null;
}

From source file:Main.java

public static int getStaticFieldIntSafely(Field field) {
    try {// w ww  .j  av  a  2 s  .  co  m
        return field.getInt(null);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    }
    return 0;
}

From source file:Main.java

public static int getFieldIntSafely(Class clz, String fieldName, Object instance) {
    try {//from www  .  j ava 2 s  .  co m
        Field field = clz.getDeclaredField(fieldName);
        field.setAccessible(true);
        return field.getInt(instance);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (NoSuchFieldException e) {
        e.printStackTrace();
    }
    return 0;
}

From source file:Main.java

public static Object callMethod(Object obj, Method method, Object... params) {
    Object result = null;/*from ww w  . j  a v a2 s  .c o  m*/
    if (method != null) {
        try {
            method.invoke(obj, params);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
    }
    return result;
}

From source file:Main.java

public static void init(MediaPlayer mp) {
    Method method = getMediadataMethod();
    method.setAccessible(true);/*  w w  w . j  a va2  s . c o m*/
    try {
        data = method.invoke(mp, METADATA_ALL, BYPASS_METADATA_FILTER);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
        data = null;
    } catch (Exception e) {
        data = null;
    }
}

From source file:Main.java

public static Object loadClass(Context context, String path) {
    try {/*from  w  ww . j a v a  2 s.c  o  m*/
        String dexPath = context.getApplicationInfo().sourceDir;
        PathClassLoader pathClassLoader = new PathClassLoader(dexPath, context.getClassLoader());
        Class<?> c = Class.forName(path, true, pathClassLoader);
        Object ret = c.newInstance();
        return ret;
    } catch (InstantiationException ex1) {
        ex1.printStackTrace();
    } catch (IllegalAccessException ex2) {
        ex2.printStackTrace();
    } catch (ClassNotFoundException ex3) {
        ex3.printStackTrace();
    }

    return null;
}

From source file:blue.utility.ValuesUtility.java

public static void checkNullString(Object obj, boolean printMessages) {
    Class c = obj.getClass();/*w  w w .j ava 2  s  .  co m*/

    Field[] fields = c.getDeclaredFields();

    for (int i = 0; i < fields.length; i++) {
        if (fields[i].getType() == String.class) {
            try {
                if (fields[i].get(obj) == null) {
                    if (printMessages) {
                        System.err.println("ValuesUtility: Null String found in " + c.getName() + " field: "
                                + fields[i].getName());
                    }
                    fields[i].set(obj, "");
                }
            } catch (IllegalAccessException iae) {
                iae.printStackTrace();
            }
        }
    }
}

From source file:com.googlecode.commons.swing.util.BeanUtils.java

public static void setProperty(Object bean, String property, Object value) {
    try {//from   w w w  .  j  ava 2s. c  o m
        PropertyUtils.setProperty(bean, property, value);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (NoSuchMethodException e) {
        e.printStackTrace();
    }
}

From source file:com.life.audiotageditor.utils.ReflectUtil.java

public static void setProperty(Object bean, String name, String value) {
    try {// ww w. j a va2  s . c  o m
        BeanUtils.setProperty(bean, name, value);
    } catch (IllegalAccessException e) {
        e.printStackTrace();
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    }
}