一、前言
关于freemarker源码包中的freemarker.template.utility.SecurityUtilities安全工具类, 获取使用系统AccessController.doPrivileged(new PrivilegedAction(key)的访问系统参数,详情参见源码说明
二、源码说明
package freemarker.template.utility;@b@@b@import java.security.AccessController;@b@import java.security.PrivilegedAction;@b@@b@public class SecurityUtilities@b@{@b@ public static String getSystemProperty(String key)@b@ {@b@ return ((String)AccessController.doPrivileged(new PrivilegedAction(key)@b@ {@b@ private final String val$key;@b@@b@ public Object run() {@b@ return System.getProperty(this.val$key);@b@ }@b@ }));@b@ }@b@@b@ public static String getSystemProperty(String key, String defValue)@b@ {@b@ return ((String)AccessController.doPrivileged(new PrivilegedAction(key, defValue) {@b@ private final String val$key;@b@ private final String val$defValue;@b@@b@ public Object run() {@b@ return System.getProperty(this.val$key, this.val$defValue);@b@ }@b@ }));@b@ }@b@@b@ public static Integer getSystemProperty(String key, int defValue)@b@ {@b@ return ((Integer)AccessController.doPrivileged(new PrivilegedAction(key, defValue) {@b@ private final String val$key;@b@ private final int val$defValue;@b@@b@ public Object run() {@b@ return Integer.getInteger(this.val$key, this.val$defValue);@b@ }@b@ }));@b@ }@b@}