Java Code Examples for org.eclipse.birt.core.exception.BirtException#ERROR

The following examples show how to use org.eclipse.birt.core.exception.BirtException#ERROR . 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: ChartCubeQueryHelper.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public synchronized static ICubeElementFactory getCubeElementFactory( )
		throws BirtException
{
	if ( cubeFactory != null )
	{
		return cubeFactory;
	}

	try
	{
		Class<?> cls = Class.forName( ICubeElementFactory.CUBE_ELEMENT_FACTORY_CLASS_NAME );
		cubeFactory = (ICubeElementFactory) SecurityUtil.newClassInstance( cls );
	}
	catch ( Exception e )
	{
		throw new ChartException( ChartReportItemConstants.ID,
				BirtException.ERROR,
				e );
	}
	return cubeFactory;
}
 
Example 2
Source File: ExceptionHandler.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
private static ErrorStatus createErrorStatus( Throwable e )
{
	String reason = null;
	String[] detail = null;
	BirtException birtException = (BirtException) e;
	if ( e instanceof DesignFileException )
	{
		detail = e.toString( ).split( "\n" ); //$NON-NLS-1$			
		reason = detail[0];
		detail[0] = LABEL_ERROR_MESSAGE + ":" + detail[0]; //$NON-NLS-1$
	}
	else
	{
		if ( e instanceof GUIException )
		{
			reason = ( (GUIException) e ).getReason( );
		}
		else
		{
			reason = MSG_BIRT_EXCEPTION_OCURR;
		}
		detail = new String[]{
			LABEL_ERROR_MESSAGE + ":" //$NON-NLS-1$
					+ birtException.getLocalizedMessage( ),
		};
	}
	String id = birtException.getPluginId( );
	if ( id == null )
	{
		id = UNKNOWN_PLUGIN;
	}
	ErrorStatus status = new ErrorStatus( id, 1001, reason, null );
	if ( !UNKNOWN_PLUGIN.equals( id ) )
	{
		status.addInformation( LABEL_PLUGIN_PROVIDER
				+ UIUtil.getPluginProvider( id ) );
		status.addInformation( LABEL_PLUGIN_NAME
				+ UIUtil.getPluginName( id ) );
		status.addInformation( LABEL_PLUGIN_ID + id );
		status.addInformation( LABEL_PLUGIN_VERSION
				+ UIUtil.getPluginVersion( id ) );
	}
	int severity = birtException.getSeverity( );
	if ( severity == ( BirtException.INFO | BirtException.ERROR ) )
	{
		severity = IStatus.ERROR;
	}
	status.addStatus( LABEL_ERROR_CODE + ":" + birtException.getErrorCode( ), severity ); //$NON-NLS-1$
	for ( int i = 0; i < detail.length; i++ )
	{
		status.addStatus( detail[i], severity );
	}
	return status;
}