当前位置: 首页>>代码示例>>Java>>正文


Java PrivilegedActionException.getMessage方法代码示例

本文整理汇总了Java中java.security.PrivilegedActionException.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java PrivilegedActionException.getMessage方法的具体用法?Java PrivilegedActionException.getMessage怎么用?Java PrivilegedActionException.getMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.security.PrivilegedActionException的用法示例。


在下文中一共展示了PrivilegedActionException.getMessage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: castToFiles

import java.security.PrivilegedActionException; //导入方法依赖的package包/类
private ArrayList<String> castToFiles(final List files,
                                      final ProtectionDomain userProtectionDomain) throws IOException
{
    final ArrayList<String> fileList = new ArrayList<String>();
    try {
        AccessController.doPrivileged(new PrivilegedExceptionAction() {
            public Object run() throws IOException {
                for (Object fileObject : files)
                {
                    File file = castToFile(fileObject);
                    if (file != null &&
                        (null == System.getSecurityManager() ||
                        !(isFileInWebstartedCache(file) ||
                        isForbiddenToRead(file, userProtectionDomain))))
                    {
                        fileList.add(file.getCanonicalPath());
                    }
                }
                return null;
            }
        });
    } catch (PrivilegedActionException pae) {
        throw new IOException(pae.getMessage());
    }
    return fileList;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:DataTransferer.java

示例2: castToFiles

import java.security.PrivilegedActionException; //导入方法依赖的package包/类
private ArrayList<String> castToFiles(final List<?> files,
                                      final ProtectionDomain userProtectionDomain) throws IOException {
    try {
        return AccessController.doPrivileged((PrivilegedExceptionAction<ArrayList<String>>) () -> {
            ArrayList<String> fileList = new ArrayList<>();
            for (Object fileObject : files)
            {
                File file = castToFile(fileObject);
                if (file != null &&
                    (null == System.getSecurityManager() ||
                    !(isFileInWebstartedCache(file) ||
                    isForbiddenToRead(file, userProtectionDomain))))
                {
                    fileList.add(file.getCanonicalPath());
                }
            }
            return fileList;
        });
    } catch (PrivilegedActionException pae) {
        throw new IOException(pae.getMessage());
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:23,代码来源:DataTransferer.java

示例3: getTgt

import java.security.PrivilegedActionException; //导入方法依赖的package包/类
private static KerberosTicket getTgt(GSSCaller caller, Krb5NameElement name,
                                             int initLifetime)
    throws GSSException {

    final String clientPrincipal;

    /*
     * Find the TGT for the realm that the client is in. If the client
     * name is not available, then use the default realm.
     */
    if (name != null) {
        clientPrincipal = (name.getKrb5PrincipalName()).getName();
    } else {
        clientPrincipal = null;
    }

    final AccessControlContext acc = AccessController.getContext();

    try {
        final GSSCaller realCaller = (caller == GSSCaller.CALLER_UNKNOWN)
                               ? GSSCaller.CALLER_INITIATE
                               : caller;
        return AccessController.doPrivileged(
            new PrivilegedExceptionAction<KerberosTicket>() {
            public KerberosTicket run() throws Exception {
                // It's OK to use null as serverPrincipal. TGT is almost
                // the first ticket for a principal and we use list.
                return Krb5Util.getTicket(
                    realCaller,
                    clientPrincipal, null, acc);
                    }});
    } catch (PrivilegedActionException e) {
        GSSException ge =
            new GSSException(GSSException.NO_CRED, -1,
                "Attempt to obtain new INITIATE credentials failed!" +
                " (" + e.getMessage() + ")");
        ge.initCause(e.getException());
        throw ge;
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:41,代码来源:Krb5InitCredential.java

示例4: removeSuspectedData

import java.security.PrivilegedActionException; //导入方法依赖的package包/类
private String removeSuspectedData(DataFlavor flavor, final Transferable contents, final String str)
        throws IOException
{
    if (null == System.getSecurityManager()
        || !flavor.isMimeTypeEqual("text/uri-list"))
    {
        return str;
    }

    final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents);

    try {
        return AccessController.doPrivileged((PrivilegedExceptionAction<String>) () -> {

            StringBuilder allowedFiles = new StringBuilder(str.length());
            String [] uriArray = str.split("(\\s)+");

            for (String fileName : uriArray)
            {
                File file = new File(fileName);
                if (file.exists() &&
                    !(isFileInWebstartedCache(file) ||
                    isForbiddenToRead(file, userProtectionDomain)))
                {
                    if (0 != allowedFiles.length())
                    {
                        allowedFiles.append("\\r\\n");
                    }

                    allowedFiles.append(fileName);
                }
            }

            return allowedFiles.toString();
        });
    } catch (PrivilegedActionException pae) {
        throw new IOException(pae.getMessage(), pae);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:40,代码来源:DataTransferer.java

示例5: removeSuspectedData

import java.security.PrivilegedActionException; //导入方法依赖的package包/类
private String removeSuspectedData(DataFlavor flavor, final Transferable contents, final String str)
        throws IOException
{
    if (null == System.getSecurityManager()
        || !flavor.isMimeTypeEqual("text/uri-list"))
    {
        return str;
    }


    String ret_val = "";
    final ProtectionDomain userProtectionDomain = getUserProtectionDomain(contents);

    try {
        ret_val = (String) AccessController.doPrivileged(new PrivilegedExceptionAction() {
                public Object run() {

                    StringBuffer allowedFiles = new StringBuffer(str.length());
                    String [] uriArray = str.split("(\\s)+");

                    for (String fileName : uriArray)
                    {
                        File file = new File(fileName);
                        if (file.exists() &&
                            !(isFileInWebstartedCache(file) ||
                            isForbiddenToRead(file, userProtectionDomain)))
                        {

                            if (0 != allowedFiles.length())
                            {
                                allowedFiles.append("\\r\\n");
                            }

                            allowedFiles.append(fileName);
                        }
                    }

                    return allowedFiles.toString();
                }
            });
    } catch (PrivilegedActionException pae) {
        throw new IOException(pae.getMessage(), pae);
    }

    return ret_val;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:47,代码来源:DataTransferer.java


注:本文中的java.security.PrivilegedActionException.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。