java.security.PrivilegedActionException#getMessage ( )源码实例Demo

下面列出了java.security.PrivilegedActionException#getMessage ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: jdk1.8-source-analysis   文件: ORBUtility.java
/**
 * Returns the maximum stream format version supported by our
 * ValueHandler.
 */
public static byte getMaxStreamFormatVersion() {
    ValueHandler vh;
    try {
        vh = AccessController.doPrivileged(new PrivilegedExceptionAction<ValueHandler>() {
            public ValueHandler run() throws Exception {
                return Util.createValueHandler();
            }
        });
    } catch (PrivilegedActionException e) {
        throw new InternalError(e.getMessage());
    }

    if (!(vh instanceof javax.rmi.CORBA.ValueHandlerMultiFormat))
        return ORBConstants.STREAM_FORMAT_VERSION_1;
    else
        return ((ValueHandlerMultiFormat)vh).getMaximumStreamFormatVersion();
}
 
源代码2 项目: jdk8u-dev-jdk   文件: DataTransferer.java
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;
}
 
源代码3 项目: jdk8u-jdk   文件: DataTransferer.java
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;
}
 
源代码4 项目: dragonwell8_jdk   文件: DataTransferer.java
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;
}
 
源代码5 项目: birt   文件: FileSecurity.java
/**
 * 
 * @param file
 * @return
 * @throws FileNotFoundException
 * @throws DataException
 */
public static FileInputStream createFileInputStream( final File file )
		throws FileNotFoundException, DataException
{
	try
	{
		return AccessController.doPrivileged( new PrivilegedExceptionAction<FileInputStream>( ) {

			public FileInputStream run( ) throws FileNotFoundException
			{
				return new FileInputStream( file );
			}
		} );
	}
	catch ( PrivilegedActionException e )
	{
		Exception typedException = e.getException( );
		if ( typedException instanceof FileNotFoundException )
		{
			throw (FileNotFoundException) typedException;
		}
		throw new DataException( e.getMessage( ) );
	}
}
 
源代码6 项目: birt   文件: ObjectSecurity.java
/**
 * 
 * @param os
 * @return
 * @throws IOException
 * @throws DataException
 */
public static ObjectOutputStream createObjectOutputStream(
		final OutputStream os ) throws IOException, DataException
{
	try
	{
		return AccessController.doPrivileged( new PrivilegedExceptionAction<ObjectOutputStream>( ) {

			public ObjectOutputStream run( ) throws IOException
			{
				return new ObjectOutputStream( os );
			}
		} );
	}
	catch ( PrivilegedActionException e )
	{
		Exception typedException = e.getException( );
		if ( typedException instanceof IOException )
		{
			throw (IOException) typedException;
		}
		throw new DataException( e.getMessage( ) );
	}
}
 
源代码7 项目: Bytecoder   文件: DataTransferer.java
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());
    }
}
 
源代码8 项目: openjdk-jdk9   文件: DataTransferer.java
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());
    }
}
 
源代码9 项目: hottub   文件: DataTransferer.java
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;
}
 
源代码10 项目: openjdk-jdk8u   文件: DataTransferer.java
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;
}
 
源代码11 项目: jdk1.8-source-analysis   文件: ORBUtility.java
/**
 * Return default ValueHandler
 */
public static ValueHandler createValueHandler() {
    ValueHandler vh;
    try {
        vh = AccessController.doPrivileged(new PrivilegedExceptionAction<ValueHandler>() {
            public ValueHandler run() throws Exception {
    return Util.createValueHandler();
}
        });
    } catch (PrivilegedActionException e) {
        throw new InternalError(e.getMessage());
    }
    return vh;
}
 
源代码12 项目: birt   文件: FileSecurity.java
/**
 * 
 * @param file
 * @return
 * @throws IOException
 * @throws DataException
 */
public static String fileGetCanonicalPath( final File file )
		throws IOException, DataException
{
	if ( file == null )
		return null;
	try
	{
		return AccessController.doPrivileged( new PrivilegedExceptionAction<String>( ) {

			public String run( ) throws IOException
			{
				return file.getCanonicalPath( );
			}
		} );
	}
	catch ( PrivilegedActionException e )
	{
		Exception typedException = e.getException( );
		if ( typedException instanceof IOException )
		{
			throw (IOException) typedException;
		}
		throw new DataException( e.getMessage( ) );

	}
}
 
源代码13 项目: openjdk-8-source   文件: Krb5InitCredential.java
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;
    }
}
 
源代码14 项目: Bytecoder   文件: DataTransferer.java
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);
    }
}
 
源代码15 项目: openjdk-jdk9   文件: DataTransferer.java
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);
    }
}
 
源代码16 项目: openjdk-jdk8u-backup   文件: ORBUtility.java
/**
 * Return default ValueHandler
 */
public static ValueHandler createValueHandler() {
    ValueHandler vh;
    try {
        vh = AccessController.doPrivileged(new PrivilegedExceptionAction<ValueHandler>() {
            public ValueHandler run() throws Exception {
    return Util.createValueHandler();
}
        });
    } catch (PrivilegedActionException e) {
        throw new InternalError(e.getMessage());
    }
    return vh;
}
 
源代码17 项目: TencentKona-8   文件: DataTransferer.java
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;
}
 
源代码18 项目: hottub   文件: DataTransferer.java
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;
}
 
源代码19 项目: jdk8u-jdk   文件: DataTransferer.java
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;
}
 
源代码20 项目: openjdk-8-source   文件: DataTransferer.java
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;
}