All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jboss.as.arquillian.container.embedded.SecurityActions Maven / Gradle / Ivy

There is a newer version: 5.1.0.Beta7
Show newest version
/*
 * Copyright The WildFly Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package org.jboss.as.arquillian.container.embedded;

import java.security.AccessController;
import java.security.PrivilegedAction;

import org.wildfly.security.manager.WildFlySecurityManager;

/**
 * Security actions to access system environment information. No methods in
 * this class are to be made public under any circumstances!
 *
 * @author Guillaume Grossetie
 */
class SecurityActions {

    private SecurityActions() {
    }

    static void setSystemProperty(final String key, final String value) {
        if (!WildFlySecurityManager.isChecking()) {
            System.setProperty(key, value);
        } else {
            AccessController.doPrivileged(new PrivilegedAction() {

                @Override
                public Void run() {
                    System.setProperty(key, value);
                    return null;
                }
            });
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy