Java Code Examples for java.security.PrivilegedActionException#getMessage()
The following examples show how to use
java.security.PrivilegedActionException#getMessage() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ORBUtility.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * 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(); }
Example 2
Source File: DataTransferer.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
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; }
Example 3
Source File: DataTransferer.java From hottub with GNU General Public License v2.0 | 6 votes |
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; }
Example 4
Source File: DataTransferer.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
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()); } }
Example 5
Source File: DataTransferer.java From Bytecoder with Apache License 2.0 | 6 votes |
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()); } }
Example 6
Source File: ObjectSecurity.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * * @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( ) ); } }
Example 7
Source File: FileSecurity.java From birt with Eclipse Public License 1.0 | 6 votes |
/** * * @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( ) ); } }
Example 8
Source File: DataTransferer.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
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; }
Example 9
Source File: DataTransferer.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
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; }
Example 10
Source File: DataTransferer.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
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; }
Example 11
Source File: Krb5InitCredential.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
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; } }
Example 12
Source File: FileSecurity.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * * @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( ) ); } }
Example 13
Source File: DataTransferer.java From Bytecoder with Apache License 2.0 | 5 votes |
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); } }
Example 14
Source File: DataTransferer.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
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); } }
Example 15
Source File: ORBUtility.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * 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; }
Example 16
Source File: ORBUtility.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * 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; }
Example 17
Source File: DataTransferer.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
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; }
Example 18
Source File: DataTransferer.java From hottub with GNU General Public License v2.0 | 4 votes |
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; }
Example 19
Source File: DataTransferer.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
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; }
Example 20
Source File: DataTransferer.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
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; }