Java 8 PrivilegedAction - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 PrivilegedAction class.

This code example shows how to use the following methods:run
                } 
                return env;
            } 
        }; 
 
        return System.getSecurityManager() == null ? action.run() : AccessController.doPrivileged(action);
    } 
 
    /** Solely for use in unit testing */ 
    public ProductConfig(final String productName, final String productVersion, final String consoleSlot) {
        this.name = productName;
        this.version = productVersion;
        this.consoleSlot = consoleSlot;
    } 
 
    public String getProductName() {
        return name;
    } 
 
    public String getProductVersion() {
7
CodeRank
This code example shows how to use the following methods:run
	 * <p> 
	 * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary 
	 * privileged actions within HV's protection domain. 
	 */ 
	private <T> T run(PrivilegedAction<T> action) {
		return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
	} 
} 
5
CodeRank
This code example shows how to use the following methods:run
 
	private static class NoPACL implements PACL { 
 
		@Override 
		public <T> T wrap(PrivilegedAction<T> privilegedAction) {
			return privilegedAction.run();
		} 
 
		@Override 
		public <T> T wrap( 
				PrivilegedExceptionAction<T> privilegedExceptionAction)
			throws Exception {
 
			return privilegedExceptionAction.run();
		} 
 
		@Override 
		public <T> T wrap(T t) {
			return t;
		} 
5
CodeRank
This code example shows how to use the following methods:run
	 * <p> 
	 * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary 
	 * privileged actions within HV's protection domain. 
	 */ 
	private <T> T run(PrivilegedAction<T> action) {
		return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
	} 
 
	public void addValidatedValueHandler(ValidatedValueUnwrapper<?> handler) {
		validatedValueHandlers.add( handler );
	} 
 
	public List<ValidatedValueUnwrapper<?>> getValidatedValueHandlers() {
		return validatedValueHandlers;
	} 
 
	public void addConstraintDefinitionContributor(ConstraintDefinitionContributor contributor) {
		constraintDefinitionContributors.add( contributor );
	} 
 
5
CodeRank
This code example shows how to use the following methods:run
	 * <p> 
	 * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary 
	 * privileged actions within HV's protection domain. 
	 */ 
	private <T> T run(PrivilegedAction<T> action) {
		return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
	} 
} 
5
CodeRank
This code example shows how to use the following methods:run
	 * <p> 
	 * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary 
	 * privileged actions within HV's protection domain. 
	 */ 
	private <T> T run(PrivilegedAction<T> action) {
		return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
	} 
 
	private <T> T run(PrivilegedExceptionAction<T> action) throws Exception {
		return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
	} 
} 
5
CodeRank
This code example shows how to use the following methods:run
 
public class Security 
{ 
	public static <T> T run(PrivilegedAction<T> action)
	{ 
		return (System.getSecurityManager() != null) ? AccessController.doPrivileged(action) : action.run();
	} 
 
	public static <T> T run(PrivilegedExceptionAction<T> action) throws Exception
	{ 
		return (System.getSecurityManager() != null) ? AccessController.doPrivileged(action) : action.run();
	} 
 
	public static <T, E extends Exception> T run(PrivilegedExceptionAction<T> action, Class<E> exceptionClass) throws E
	{ 
		try 
		{ 
			return (System.getSecurityManager() != null) ? AccessController.doPrivileged(action) : action.run();
		} 
		catch (Exception e)
4
CodeRank
This code example shows how to use the following methods:run
	 * <p> 
	 * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary 
	 * privileged actions within HV's protection domain. 
	 */ 
	private <T> T run(PrivilegedAction<T> action) {
		return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
	} 
 
	/** 
	 * A filter implementation filtering methods matching given methods. 
	 * 
	 * @author Gunnar Morling 
	 */ 
	private static class SimpleMethodFilter implements Filter<RawMethod> { 
		private final Method method1;
		private final Method method2;
 
		private SimpleMethodFilter(Method method1, Method method2) {
			this.method1 = method1;
			this.method2 = method2;
5
CodeRank
This code example shows how to use the following methods:run
	 * <p> 
	 * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary 
	 * privileged actions within HV's protection domain. 
	 */ 
	private static <T> T run(PrivilegedAction<T> action) {
		return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
	} 
} 
5
CodeRank
This code example shows how to use the following methods:run
	 * <p> 
	 * <b>NOTE:</b> This must never be changed into a publicly available method to avoid execution of arbitrary 
	 * privileged actions within HV's protection domain. 
	 */ 
	private static <T> T run(PrivilegedAction<T> action) {
		return System.getSecurityManager() != null ? AccessController.doPrivileged( action ) : action.run();
	} 
} 
5
CodeRank
See Code Examples for Java 8 PrivilegedAction Methods: