@SuppressWarnings("unchecked") private Class validateClass(ClientConfig cfg){
  Class clazz=null;
  try {
    clazz=Class.forName(cfg.getAccessRequestHandlerClassname());
  }
 catch (  final ClassNotFoundException e) {
    LOG.error("Unable to load Handler Class '" + cfg.getAccessRequestHandlerClassname() + "' for RADIUS client '"+ cfg.getName()+ "'. Requests from this client will be ignored.",e);
    return null;
  }
  Object inst=null;
  try {
    inst=InjectorHolder.getInstance(clazz);
  }
 catch (  ConfigurationException|ProvisionException e) {
    LOG.error("Unable to instantiate Handler Class '" + cfg.getAccessRequestHandlerClassname() + "' for RADIUS client '"+ cfg.getName()+ "'. Requests from this client will be ignored.",e);
    return null;
  }
  AccessRequestHandler handler=null;
  try {
    handler=(AccessRequestHandler)inst;
  }
 catch (  final ClassCastException e) {
    LOG.error("Unable to use Handler Class '" + cfg.getAccessRequestHandlerClassname() + "' for RADIUS client '"+ cfg.getName()+ "'. Requests from this client will be ignored.",e);
    return null;
  }
  return clazz;
}

@ SuppressWarnings ( "unchecked" ) private Class validateClass ( ClientConfig cfg ) { Class clazz = null ; try { clazz = Class . forName ( cfg . getAccessRequestHandlerClassname ( ) ) ; } catch ( final ClassNotFoundException e ) { LOG . error ( "Unable to load Handler Class '" + cfg . getAccessRequestHandlerClassname ( ) + "' for RADIUS client '" + cfg . getName ( ) + "'. Requests from this client will be ignored." , e ) ; return null ; } Object inst = null ; try { inst = InjectorHolder . getInstance ( clazz ) ; } catch ( ConfigurationException | ProvisionException e ) { LOG . error ( "Unable to instantiate Handler Class '" + cfg . getAccessRequestHandlerClassname ( ) + "' for RADIUS client '" + cfg . getName ( ) + "'. Requests from this client will be ignored." , e ) ; return null ; } AccessRequestHandler handler = null ; try { handler = ( AccessRequestHandler ) inst ; } catch ( final ClassCastException e ) { LOG . error ( "Unable to use Handler Class '" + cfg . getAccessRequestHandlerClassname ( ) + "' for RADIUS client '" + cfg . getName ( ) + "'. Requests from this client will be ignored." , e ) ; return null ; } return clazz ; }
validates that the specified class can be loaded and implements the proper interface so that we don ' t have to do that for every request .
