public Class<?> loadBeanClass(final String className) { try { return (Class<?>) AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() { public Object run() throws Exception { return Class.forName(className, true, getClassLoader(this.getClass())); } }); } catch (PrivilegedActionException pae) { throw new WeldException(BeanMessage.CANNOT_LOAD_CLASS, className, pae.getException()); } }
@Override public final WeldException unableToGetFieldOnDeserialization(final Object param1, final Object param2, final Throwable cause) { final WeldException result = new WeldException(java.text.MessageFormat.format(unableToGetFieldOnDeserialization$str(), param1, param2), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String incorrectNumberOfAnnotatedParametersMethod = "WELD-000614: Incorrect number of AnnotatedParameters {0} on AnnotatedMethod {1}. AnnotatedMethod has {2} as parameters but should have {3} as parameters";
@Override public final WeldException reflectionfactoryInstantiationFailed(final Object param1, final Throwable cause) { final WeldException result = new WeldException(java.text.MessageFormat.format(reflectionfactoryInstantiationFailed$str(), param1), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String unsafeInstantiationFailed = "WELD-000617: Instantiation through Unsafe of {0} failed";
static <T> T newConstructorInstance(Class<T> javaClass, Class<?>[] constructorParamTypes, Object... constructorParamInstances) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { if (System.getSecurityManager() != null) { try { return AccessController.doPrivileged(ConstructorNewInstanceAction.of(javaClass, constructorParamTypes, constructorParamInstances)); } catch (PrivilegedActionException e) { throw new WeldException(e.getCause()); } } else { return javaClass.getConstructor(constructorParamTypes).newInstance(constructorParamInstances); } }
@Override public final WeldException producerCastError(final Object param1, final Object param2, final Throwable cause) { final WeldException result = new WeldException(java.text.MessageFormat.format(producerCastError$str(), param1, param2), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String nullNotAllowedFromProducer = "WELD-000052: Cannot return null from a non-dependent producer method: {0}\n\tat {1}\n StackTrace:";
static <T> T newConstructorInstance(Class<T> javaClass, Class<?>[] constructorParamTypes, Object... constructorParamInstances) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { if (System.getSecurityManager() != null) { try { return AccessController.doPrivileged(ConstructorNewInstanceAction.of(javaClass, constructorParamTypes, constructorParamInstances)); } catch (PrivilegedActionException e) { throw new WeldException(e.getCause()); } } else { return javaClass.getConstructor(constructorParamTypes).newInstance(constructorParamInstances); } }
@Override public final WeldException unableToGetMethodOnDeserialization(final Object param1, final Object param2, final Throwable cause) { final WeldException result = new WeldException(java.text.MessageFormat.format(unableToGetMethodOnDeserialization$str(), param1, param2), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String unableToGetFieldOnDeserialization = "WELD-000612: Unable to deserialize field. Declaring class {0}, field name {1}";
static <T> T newConstructorInstance(Class<T> javaClass, Class<?>[] constructorParamTypes, Object... constructorParamInstances) throws InstantiationException, IllegalAccessException, NoSuchMethodException, InvocationTargetException { if (System.getSecurityManager() != null) { try { return AccessController.doPrivileged(ConstructorNewInstanceAction.of(javaClass, constructorParamTypes, constructorParamInstances)); } catch (PrivilegedActionException e) { throw new WeldException(e.getCause()); } } else { return javaClass.getConstructor(constructorParamTypes).newInstance(constructorParamInstances); } }
@Override public final WeldException unableToGetFieldOnDeserialization(final Object param1, final Object param2, final Throwable cause) { final WeldException result = new WeldException(java.text.MessageFormat.format(unableToGetFieldOnDeserialization$str(), param1, param2), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String incorrectNumberOfAnnotatedParametersMethod = "WELD-000614: Incorrect number of AnnotatedParameters {0} on AnnotatedMethod {1}. AnnotatedMethod has {2} as parameters but should have {3} as parameters";
static <T> Constructor<T> getConstructor(Class<T> javaClass, Class<?>... parameterTypes) throws NoSuchMethodException { if (System.getSecurityManager() != null) { try { return AccessController.doPrivileged(GetConstructorAction.of(javaClass, parameterTypes)); } catch (PrivilegedActionException e) { if (e.getCause() instanceof NoSuchMethodException) { throw (NoSuchMethodException) e.getCause(); } throw new WeldException(e.getCause()); } } else { return javaClass.getConstructor(parameterTypes); } }
@Override public final WeldException reflectionfactoryInstantiationFailed(final Object param1, final Throwable cause) { final WeldException result = new WeldException(java.text.MessageFormat.format(reflectionfactoryInstantiationFailed$str(), param1), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String unsafeInstantiationFailed = "WELD-000617: Instantiation through Unsafe of {0} failed";
static <T> Field getDeclaredField(Class<T> javaClass, String name) throws NoSuchFieldException { if (System.getSecurityManager() != null) { try { return AccessController.doPrivileged(new GetDeclaredFieldAction(javaClass, name)); } catch (PrivilegedActionException e) { if (e.getCause() instanceof NoSuchFieldException) { throw (NoSuchFieldException) e.getCause(); } throw new WeldException(e.getCause()); } } else { return javaClass.getDeclaredField(name); } }
@Override public final WeldException unsafeInstantiationFailed(final Object param1, final Throwable cause) { final WeldException result = new WeldException(java.text.MessageFormat.format(unsafeInstantiationFailed$str(), param1), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } @Override
static <T> Constructor<T> getConstructor(Class<T> javaClass, Class<?>... parameterTypes) throws NoSuchMethodException { if (System.getSecurityManager() != null) { try { return AccessController.doPrivileged(GetConstructorAction.of(javaClass, parameterTypes)); } catch (PrivilegedActionException e) { if (e.getCause() instanceof NoSuchMethodException) { throw (NoSuchMethodException) e.getCause(); } throw new WeldException(e.getCause()); } } else { return javaClass.getConstructor(parameterTypes); } }
@Override public final WeldException cannotLoadClass(final Object param1, final Throwable cause) { final WeldException result = new WeldException(java.text.MessageFormat.format(cannotLoadClass$str(), param1), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String proxyDeserializationFailure = "WELD-001500: Failed to deserialize proxy object with beanId {0}";
static <T> Field getDeclaredField(Class<T> javaClass, String name) throws NoSuchFieldException { if (System.getSecurityManager() != null) { try { return AccessController.doPrivileged(new GetDeclaredFieldAction(javaClass, name)); } catch (PrivilegedActionException e) { if (e.getCause() instanceof NoSuchFieldException) { throw (NoSuchFieldException) e.getCause(); } throw new WeldException(e.getCause()); } } else { return javaClass.getDeclaredField(name); } }
@Override public final WeldException illegalArgumentExceptionOnReflectionInvocation(final Class<? extends Object> clazz, final Object instance, final Method method, final String parameters, final Throwable cause) { final WeldException result = new WeldException(java.text.MessageFormat.format(illegalArgumentExceptionOnReflectionInvocation$str(), clazz, instance, method, parameters), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } private static final String unknownType = "WELD-000623: Unknown type {0}.";
static <T> Field getDeclaredField(Class<T> javaClass, String name) throws NoSuchFieldException { if (System.getSecurityManager() != null) { try { return AccessController.doPrivileged(new GetDeclaredFieldAction(javaClass, name)); } catch (PrivilegedActionException e) { if (e.getCause() instanceof NoSuchFieldException) { throw (NoSuchFieldException) e.getCause(); } throw new WeldException(e.getCause()); } } else { return javaClass.getDeclaredField(name); } }
@Override public final WeldException noSuchMethodWrapper(final NoSuchMethodException cause, final String message) { final WeldException result = new WeldException(java.text.MessageFormat.format(noSuchMethodWrapper$str(), message), cause); final StackTraceElement[] st = result.getStackTrace(); result.setStackTrace(Arrays.copyOfRange(st, 1, st.length)); return result; } @Override
static <T> Constructor<T> getConstructor(Class<T> javaClass, Class<?>... parameterTypes) throws NoSuchMethodException { if (System.getSecurityManager() != null) { try { return AccessController.doPrivileged(GetConstructorAction.of(javaClass, parameterTypes)); } catch (PrivilegedActionException e) { if (e.getCause() instanceof NoSuchMethodException) { throw (NoSuchMethodException) e.getCause(); } throw new WeldException(e.getCause()); } } else { return javaClass.getConstructor(parameterTypes); } }