Package org.jboss.weld.security

Examples of org.jboss.weld.security.GetDeclaredFieldAction


    @SuppressWarnings(value = { "DE_MIGHT_IGNORE", "REC_CATCH_EXCEPTION" }, justification = "The exception is expected to be ignored.")
    private void init() {
        try {
            Class<?> unsafe = Class.forName(REFLECTION_CLASS_NAME);
            Field accessor = AccessController.doPrivileged(new GetDeclaredFieldAction(unsafe, "theUnsafe"));
            AccessController.doPrivileged(SetAccessibleAction.of(accessor));
            unsafeInstance = accessor.get(null);
            allocateInstanceMethod = AccessController.doPrivileged(new GetDeclaredMethodAction(unsafe, "allocateInstance", Class.class));
        } catch (Exception e) {
            // OK to fail
View Full Code Here


        }
    }

    @Test
    public void testGetDeclaredField() throws PrivilegedActionException {
        Assert.assertNotNull(AccessController.doPrivileged(new GetDeclaredFieldAction(TestObject.class, "publicField")));
    }
View Full Code Here

    }

    @Test(expected = NoSuchFieldException.class)
    public void testGetDeclaredFieldNotFound() throws Throwable {
        try {
            AccessController.doPrivileged(new GetDeclaredFieldAction(TestObject.class, "eioota"));
        } catch (PrivilegedActionException e) {
            throw e.getCause();
        }
    }
View Full Code Here

    @Override
    public T create(BeanInstance beanInstance) {
        try {
            final T instance = super.create(beanInstance);
            if (beanIdField == null) {
                final Field f = AccessController.doPrivileged(new GetDeclaredFieldAction(instance.getClass(), BEAN_ID_FIELD));
                AccessController.doPrivileged(SetAccessibleAction.of(f));
                beanIdField = f;
            }
            if (threadLocalCacheField == null && isUsingUnsafeInstantiators()) {
                final Field f = AccessController.doPrivileged(new GetDeclaredFieldAction(instance.getClass(),  CACHE_FIELD));
                AccessController.doPrivileged(SetAccessibleAction.of(f));
                threadLocalCacheField = f;
            }
            if(isUsingUnsafeInstantiators()) {
                threadLocalCacheField.set(instance, new ThreadLocal());
View Full Code Here

TOP

Related Classes of org.jboss.weld.security.GetDeclaredFieldAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.