Example usage for java.lang IllegalAccessException getMessage

List of usage examples for java.lang IllegalAccessException getMessage

Introduction

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

Prototype

public String getMessage() 

Source Link

Document

Returns the detail message string of this throwable.

Usage

From source file:net.jradius.server.Main.java

public static void main(String[] args) {
    if (args.length != 1) {
        showUsage();//from  ww w .j  a  va2s  . c o m
        System.exit(1);
    }

    /**
     * CADBiS daemon run
     * --->
     */
    if (JRadiusConfigurator.getInstance().getProperty("cadbis_daemon").equals("enabled"))
        CADBiS.getInstance().start();
    /**
     * <--- eof CADBiS
     */

    String configFilePath = args[0];

    try {
        File file = new File(configFilePath);
        Configuration.initialize(file);
        JRadiusServer server = new JRadiusServer();
        server.start();
    } catch (FileNotFoundException e) {
        System.err.println("Error: The configuration file '" + configFilePath + "' does not exist.");
    } catch (ConfigurationException e1) {
        System.err.println("Error: The configuration file could not be read,"
                + " because the file contains an error: " + e1.getMessage());
        showStackTrace(e1);
    } catch (SecurityException e2) {
        System.err.println("Error: The configuration file could not be read,"
                + " because a security error occurred: " + e2.getMessage());
        showStackTrace(e2);
    } catch (IllegalArgumentException e3) {
        System.err.println("Error: The configuration file could not be read,"
                + " because an illegal argument error occurred: " + e3.getMessage());
        showStackTrace(e3);
    } catch (ClassNotFoundException e4) {
        System.err.println("Error: The configuration file could not be read,"
                + " because a class specified in the configuration file could not be found: "
                + e4.getMessage());
        showStackTrace(e4);
    } catch (NoSuchMethodException e5) {
        System.err.println("Error: The configuration file could not be read,"
                + " because a method does not exist in a class specified in the configuration file: "
                + e5.getMessage());
        showStackTrace(e5);
    } catch (InstantiationException e6) {
        System.err.println("Error: The configuration file could not be read,"
                + " because an object specified in the configuration file could not be instantiated: "
                + e6.getMessage());
        showStackTrace(e6);
    } catch (IllegalAccessException e7) {
        System.err.println("Error: The configuration file could not be read,"
                + " because an illegal access error occurred: " + e7.getMessage());
        showStackTrace(e7);
    } catch (InvocationTargetException e8) {
        System.err.println("Error: The configuration file could not be read,"
                + " because an invocation target exception was thrown: " + e8.getMessage());
        showStackTrace(e8);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return;
}

From source file:org.openiam.idm.srvc.auth.context.AuthContextFactory.java

public static AuthenticationContext createContext(String className) throws ClassNotFoundException {
    Class cls = Class.forName(className);
    try {//from   w w  w . ja  v  a2s.com
        return (AuthenticationContext) cls.newInstance();
    } catch (IllegalAccessException ia) {
        log.error(ia.getMessage(), ia);

    } catch (InstantiationException ie) {
        log.error(ie.getMessage(), ie);
    }
    return null;

}

From source file:org.openiam.idm.srvc.auth.spi.LoginModuleFactory.java

public static LoginModule createModule(String className) throws ClassNotFoundException {
    Class cls = Class.forName(className);
    try {/*  w w  w  . j a va 2 s . c  om*/
        return (LoginModule) cls.newInstance();
    } catch (IllegalAccessException ia) {
        log.error(ia.getMessage(), ia);

    } catch (InstantiationException ie) {
        log.error(ie.getMessage(), ie);
    }
    return null;

}

From source file:org.openiam.script.ScriptFactory.java

public static ScriptIntegration createModule(String className) throws ClassNotFoundException {
    Class cls = Class.forName(className);
    try {// w w w  .  j  a v a  2 s.  c o  m
        return (ScriptIntegration) cls.newInstance();
    } catch (IllegalAccessException ia) {
        log.error(ia.getMessage(), ia);

    } catch (InstantiationException ie) {
        log.error(ie.getMessage(), ie);
    }
    return null;

}

From source file:com.daxia.generator.util.BeanMapper.java

/**
 * DozerA?B.//from   w w w.j a v  a  2  s  .  c om
 */
public static void copy(Object source, Object destinationObject) {
    // dozer.map(source, destinationObject);
    try {
        BeanUtils.copyProperties(destinationObject, source);
    } catch (IllegalAccessException e) {
        throw new RuntimeException(e.getMessage(), e);
    } catch (InvocationTargetException e) {
        throw new RuntimeException(e.getMessage(), e);
    }
}

From source file:org.ngrinder.common.util.ReflectionUtils.java

/**
 * Get object field value, bypassing getter method.
 * /*from  w ww . j  ava 2 s  .  c  o  m*/
 * @param object   object
 * @param fieldName   field Name
 * @return fileValue
 */
public static Object getFieldValue(final Object object, final String fieldName) {
    Field field = getDeclaredField(object, fieldName);
    checkNotNull(field, "Could not find field [%s] on target [%s]", fieldName, object);
    makeAccessible(field);

    try {
        return field.get(object);
    } catch (IllegalAccessException e) {
        LOGGER.error(e.getMessage(), e);
    }
    return null;
}

From source file:org.ngrinder.common.util.ReflectionUtil.java

/**
 * get object field value, bypassing getter method.
 * /*from   w w  w. j a va 2  s  . c  om*/
 * @param object
 *            object
 * @param fieldName
 *            field Name
 * @return fileValue
 */
public static Object getFieldValue(final Object object, final String fieldName) {
    Field field = getDeclaredField(object, fieldName);
    checkNotNull(field, "Could not find field [%s] on target [%s]", fieldName, object);
    makeAccessible(field);

    try {
        return field.get(object);
    } catch (IllegalAccessException e) {
        LOG.error(e.getMessage(), e);
    }
    return null;
}

From source file:cn.wanghaomiao.seimi.utils.StructValidator.java

public static boolean validateAnno(Object object) {
    for (Field field : object.getClass().getDeclaredFields()) {
        NotNull notNullCheck = field.getAnnotation(NotNull.class);
        if (notNullCheck != null) {
            try {
                Object val = FieldUtils.readField(field, object, true);
                if (StringUtils.isBlank(String.valueOf(val))) {
                    logger.error("Field={}.{} can not be null!", object.getClass().getSimpleName(),
                            field.getName());
                    return false;
                }//from ww w.j a  va  2s  .  co  m
            } catch (IllegalAccessException e) {
                logger.error(e.getMessage(), e);
            }
        }
    }
    return true;
}

From source file:Main.java

public static Object getObjectField(Object obj, String fieldName) {
    try {// w w w  . j a va  2 s.c  o m
        return findField(obj.getClass(), fieldName).get(obj);
    } catch (IllegalAccessException e) {
        // should not happen
        Log.v("test", e.getMessage());
        throw new IllegalAccessError(e.getMessage());
    } catch (IllegalArgumentException e) {
        throw e;
    }
}

From source file:org.dmlc.xgboost4j.util.Initializer.java

/**
 * add libPath to java.library.path, then native library in libPath would be load properly
 * @param libPath//from   w  w w.  j  a  v a2  s .c  om
 * @throws IOException 
 */
public static void addNativeDir(String libPath) throws IOException {
    try {
        Field field = ClassLoader.class.getDeclaredField("usr_paths");
        field.setAccessible(true);
        String[] paths = (String[]) field.get(null);
        for (String path : paths) {
            if (libPath.equals(path)) {
                return;
            }
        }
        String[] tmp = new String[paths.length + 1];
        System.arraycopy(paths, 0, tmp, 0, paths.length);
        tmp[paths.length] = libPath;
        field.set(null, tmp);
    } catch (IllegalAccessException e) {
        logger.error(e.getMessage());
        throw new IOException("Failed to get permissions to set library path");
    } catch (NoSuchFieldException e) {
        logger.error(e.getMessage());
        throw new IOException("Failed to get field handle to set library path");
    }
}