List of usage examples for java.security AccessController doPrivilegedWithCombiner
@CallerSensitive public static <T> T doPrivilegedWithCombiner(PrivilegedExceptionAction<T> action) throws PrivilegedActionException
From source file:org.openremote.controller.service.Deployer.java
/** * Returns the system user login name, or an empty string if access to system user information * has been denied.// ww w . j av a 2 s . co m * * @return system user login name or empty string */ private String getSystemUser() { try { // ----- BEGIN PRIVILEGED CODE BLOCK ------------------------------------------------------ return AccessController.doPrivilegedWithCombiner(new PrivilegedAction<String>() { @Override public String run() { return System.getProperty("user.name"); } }); // ----- END PRIVILEGED CODE BLOCK -------------------------------------------------------- } catch (SecurityException e) { log.info("Security manager has denied access to user login name: {0}", e, e.getMessage()); return ""; } }