Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.infinispan.client.hotrod;
  
Privileged actions for package org.infinispan.client.hotrod Do not move. Do not change class and method visibility to avoid being called from other java.security.CodeSources, thus granting privilege escalation to external code.

Author(s):
Scott.Stark@jboss.org
Since:
4.2
 
 final class SecurityActions {
 
    interface SysProps {
 
       SysProps NON_PRIVILEGED = new SysProps() {
          @Override
          public String getProperty(final String namefinal String defaultValue) {
             return System.getProperty(namedefaultValue);
          }
 
          @Override
          public String getProperty(final String name) {
             return System.getProperty(name);
          }
 
          @Override
          public String setProperty(String nameString value) {
             return System.setProperty(namevalue);
          }
       };
 
       SysProps PRIVILEGED = new SysProps() {
          @Override
          public String getProperty(final String namefinal String defaultValue) {
             PrivilegedAction<Stringaction = new PrivilegedAction<String>() {
                @Override
                public String run() {
                   return System.getProperty(namedefaultValue);
                }
             };
             return AccessController.doPrivileged(action);
          }
 
          @Override
          public String getProperty(final String name) {
             PrivilegedAction<Stringaction = new PrivilegedAction<String>() {
                @Override
                public String run() {
                   return System.getProperty(name);
                }
             };
             return AccessController.doPrivileged(action);
          }
 
          @Override
          public String setProperty(final String namefinal String value) {
             PrivilegedAction<Stringaction = new PrivilegedAction<String>() {
                @Override
                public String run() {
                   return System.setProperty(namevalue);
                }
             };
             return AccessController.doPrivileged(action);
          }
       };
 
       String getProperty(String nameString defaultValue);
 
       String getProperty(String name);
 
       String setProperty(String nameString value);
    }
 
    static String getProperty(String nameString defaultValue) {
       if (System.getSecurityManager() == null)
          return ..getProperty(namedefaultValue);
 
       return ..getProperty(namedefaultValue);
    }
 
    static String getProperty(String name) {
       if (System.getSecurityManager() == null)
          return ..getProperty(name);
 
       return ..getProperty(name);
    }
 
    static String setProperty(String nameString value) {
       if (System.getSecurityManager() == null) {
          return ..setProperty(namevalue);
       } else {
          return ..setProperty(namevalue);
       }
 
    }
New to GrepCode? Check out our FAQ X