public Object instantiate() { if ( isAbstract ) { throw new InstantiationException( "Cannot instantiate abstract class or interface: ", mappedClass ); } else if ( optimizer != null ) { return optimizer.newInstance(); } else if ( constructor == null ) { throw new InstantiationException( "No default constructor for entity: ", mappedClass ); } else { try { return constructor.newInstance( (Object[]) null ); } catch ( Exception e ) { throw new InstantiationException( "Could not instantiate entity: ", mappedClass, e ); } } }
public Object instantiate() { if ( ReflectHelper.isAbstractClass(mappedClass) ) { throw new InstantiationException( "Cannot instantiate abstract class or interface: ", mappedClass ); } else if ( optimizer != null ) { return optimizer.newInstance(); } else if ( constructor == null ) { throw new InstantiationException( "No default constructor for entity: ", mappedClass ); } else { try { return constructor.newInstance( null ); } catch ( Exception e ) { throw new InstantiationException( "Could not instantiate entity: ", mappedClass, e ); } } }
@Override public Object newInstance() { try { return fastClass.newInstance(); } catch ( Exception e ) { throw new InstantiationException( "Could not instantiate entity with Javassist optimizer: ", fastClass.getJavaClass(), e ); } }
/** * Creates an iv-user header filter to get user id from TAM/Webseal. * * @return the request header authentication filter * @throws Exception * the exception if something goes wrong */ private RequestHeaderAuthenticationFilter createIVUserHeaderFilter() { RequestHeaderAuthenticationFilter requestFilter = new RequestHeaderAuthenticationFilter(); requestFilter.setPrincipalRequestHeader("iv-user"); requestFilter.setExceptionIfHeaderMissing(false); requestFilter.setCheckForPrincipalChanges(true); try { requestFilter.setAuthenticationManager(this.authenticationManagerBean()); } catch (Exception e) { LOG.error("Error during security setup", e); throw new InstantiationException("Error creating authentication manager", WebSecurityConfig.class, e); } return requestFilter; }
private static Object instantiate(Constructor constructor) { try { return constructor.newInstance(null); } catch (Exception e) { throw new InstantiationException( "could not instantiate test object", constructor.getDeclaringClass(), e ); } }
public Object newInstance() { try { return fastClass.newInstance(); } catch ( Throwable t ) { throw new InstantiationException( "Could not instantiate entity with Javassist optimizer: ", fastClass.getJavaClass(), t ); } }
public Object newInstance() { try { return fastClass.newInstance(); } catch ( Throwable t ) { throw new InstantiationException( "Could not instantiate entity with CGLIB optimizer: ", fastClass.getJavaClass(), t ); } }
/** * Instantiate a class using the provided Constructor * * @param constructor The constructor * * @return The instantiated object * * @throws InstantiationException if something went wrong */ private static Object instantiate(Constructor constructor) { try { return constructor.newInstance(); } catch (Exception e) { throw new InstantiationException( "could not instantiate test object", constructor.getDeclaringClass(), e ); } }