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

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

源代码1 项目: birt   文件: URLSecurity.java
/**
 * 
 * @param protocol
 * @param host
 * @param file
 * @return
 * @throws MalformedURLException
 * @throws DataException
 */
public static URL getURL( final String protocol, final String host,
		final String file ) throws MalformedURLException, DataException
{
	try
	{
		return AccessController.doPrivileged( new PrivilegedExceptionAction<URL>( ) {

			public URL run( ) throws MalformedURLException
			{
				return new URL( protocol, host, file );
			}
		} );
	}
	catch ( PrivilegedActionException e )
	{
		Exception typedException = e.getException( );
		if ( typedException instanceof MalformedURLException )
		{
			throw (MalformedURLException) typedException;
		}
		throw new DataException( e.getLocalizedMessage( ) );
	}

}
 
源代码2 项目: birt   文件: URLSecurity.java
/**
 * 
 * @param spec
 * @return
 * @throws MalformedURLException
 * @throws DataException
 */
public static URL getURL( final String spec ) throws MalformedURLException, DataException
{
	try
	{
		return AccessController.doPrivileged( new PrivilegedExceptionAction<URL>( ) {

			public URL run( ) throws MalformedURLException
			{
				return new URL( spec );
			}
		} );
	}
	catch ( PrivilegedActionException e )
	{
		Exception typedException = e.getException( );
		if ( typedException instanceof MalformedURLException )
		{
			throw (MalformedURLException) typedException;
		}
		throw new DataException( e.getLocalizedMessage( ) );
	}

}
 
源代码3 项目: birt   文件: FileSecurity.java
/**
 * 
 * @param path
 * @param type
 * @return
 * @throws FileNotFoundException
 * @throws DataException
 */
public static RandomAccessFile createRandomAccessFile( final String path,
		final String type ) throws FileNotFoundException, DataException
{
	try
	{
		return AccessController.doPrivileged( new PrivilegedExceptionAction<RandomAccessFile>( ) {

			public RandomAccessFile run( ) throws FileNotFoundException
			{
				return new RandomAccessFile( path, type );
			}
		} );
	}
	catch ( PrivilegedActionException e )
	{
		Exception typedException = e.getException( );
		if ( typedException instanceof FileNotFoundException )
		{
			throw (FileNotFoundException) typedException;
		}
		throw new DataException( e.getLocalizedMessage( ) );
	}
}
 
源代码4 项目: birt   文件: FileSecurity.java
/**
 * 
 * @param file
 * @return
 * @throws FileNotFoundException
 * @throws DataException
 */
public static FileReader createFileReader( final File file )
		throws FileNotFoundException, DataException
{
	try
	{
		return AccessController.doPrivileged( new PrivilegedExceptionAction<FileReader>( ) {

			public FileReader run( ) throws FileNotFoundException
			{
				return new FileReader( file );
			}
		} );
	}
	catch ( PrivilegedActionException e )
	{
		Exception typedException = e.getException( );
		if ( typedException instanceof FileNotFoundException )
		{
			throw (FileNotFoundException) typedException;
		}
		throw new DataException( e.getLocalizedMessage( ) );
	}
}