@Override public void tearDown() { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current); } };
private static byte[] initSecContext(final GSSContext gssContext, final byte[] inputBuf, final int offset, final int len) throws GSSException { final ClassLoader old = WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(GssapiClient.class); try { return gssContext.initSecContext(inputBuf, offset, len); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(old); } }
private static byte[] initSecContext(final GSSContext gssContext, final byte[] inputBuf, final int offset, final int len) throws GSSException { final ClassLoader old = WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(Gs2SaslClient.class); try { return gssContext.initSecContext(inputBuf, offset, len); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(old); } } }
@Override public Handle setup() { final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader); return new Handle() { @Override public void tearDown() { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current); } }; } }
@Override public String getJndiViewInstanceValue() { final ClassLoader cl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(objectFactoryClassInstance.getClass().getClassLoader()); return String.valueOf(getReference().getInstance()); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(cl); } } });
@Override public String getInstanceClassName() { final ClassLoader cl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(objectFactoryClassInstance.getClass().getClassLoader()); final Object value = getReference().getInstance(); return value != null ? value.getClass().getName() : ContextListManagedReferenceFactory.DEFAULT_INSTANCE_CLASS_NAME; } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(cl); } }
@Override public String getJndiViewInstanceValue() { final ClassLoader cl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(objectFactoryClassInstance.getClass().getClassLoader()); return String.valueOf(getReference().getInstance()); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(cl); } } }
private ClassLoader setClassLoaderTo(final ClassLoader targetClassLoader){ ClassLoader current = null; if(WildFlySecurityManager.isChecking()){ current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(targetClassLoader); } else { current = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(targetClassLoader); } return current; } }
private ClassLoader setClassLoaderTo(final ClassLoader targetClassLoader){ ClassLoader current = null; if(WildFlySecurityManager.isChecking()){ current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(targetClassLoader); } else { current = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(targetClassLoader); } return current; } }
public static Class<?> loadClass(final String className, final Module module) throws ClassNotFoundException { final ClassLoader oldTccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(module.getClassLoader()); return Class.forName(className, false, module.getClassLoader()); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl); } }
@Override public List<Long> getRunningExecutions(final String jobName) throws NoSuchJobException, JobSecurityException { checkState(jobName); final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader); return super.getRunningExecutions(jobName); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current); } }
@Override public List<JobInstance> getJobInstances(final String jobName, final int start, final int count) throws NoSuchJobException, JobSecurityException { checkState(jobName); final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader); return super.getJobInstances(jobName, start, count); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current); } }
@Override public int getJobInstanceCount(final String jobName) throws NoSuchJobException, JobSecurityException { checkState(jobName); final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader); return super.getJobInstanceCount(jobName); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current); } }
@Override public ValidatorContext usingContext() { final ClassLoader oldTCCL = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { // Make sure the deployment's CL is set WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader); return getDelegate().usingContext(); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTCCL); } }
@Override public void stop(final StopContext context) { final ClassLoader cl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader); ValidatorFactory validatorFactory = deploymentUnit.getAttachment(BeanValidationAttachments.VALIDATOR_FACTORY); if (validatorFactory != null) { validatorFactory.close(); } } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(cl); } }
@Override public ResetContextHandle setup() throws IllegalStateException { final ClassLoaderResetContextHandle resetContextHandle = new ClassLoaderResetContextHandle(WildFlySecurityManager.getCurrentContextClassLoaderPrivileged()); WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader); return resetContextHandle; }
private void deactivate() { ClassLoader oldTccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader); endpoint.deactivate(endpointFactory, activationSpec); } catch (ResourceException re) { throw EjbLogger.ROOT_LOGGER.failureDuringEndpointDeactivation(this.getComponentName(), re); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl); } }
@Override public List<JobExecution> getJobExecutions(final JobInstance instance) throws NoSuchJobInstanceException, JobSecurityException { checkState(); final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader); validateJob(instance == null ? null : instance.getJobName()); return super.getJobExecutions(instance); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current); } }
private ValidatorFactory initFactory() { final ClassLoader oldTCCL = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader); return Validation.byDefaultProvider().providerResolver(new WildFlyProviderResolver()).configure() .buildValidatorFactory(); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTCCL); } }
@Override public void stop(final long executionId) throws NoSuchJobExecutionException, JobExecutionNotRunningException, JobSecurityException { checkState(null, "stop"); final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(); try { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader); final JobInstance instance = super.getJobInstance(executionId); validateJob(instance.getJobName()); super.stop(executionId); } finally { WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current); } }