if ( isValidDocument )
if ( documentFile != null && isValidDocument )
	protected IViewerReportDesignHandle getDesignHandle( ) throws Exception	{		if ( viewer == null )			return null;		IViewerReportDesignHandle design = null;		IReportRunnable reportRunnable = null;		// Get the absolute report design and document file path		String designFile = createAbsolutePath( viewer.getReportDesign( ) );		String documentFile = createAbsolutePath( viewer.getReportDocument( ) );		HttpServletRequest request = (HttpServletRequest) pageContext				.getRequest( );		// check if document file path is valid		boolean isValidDocument = ParameterAccessor				.isValidFilePath( documentFile );		if ( isValidDocument )		{			// open the document instance			IReportDocument reportDocumentInstance = ReportEngineService					.getInstance( ).openReportDocument( designFile,							documentFile, getModuleOptions( ) );			if ( reportDocumentInstance != null )			{				this.documentInUrl = true;				reportRunnable = reportDocumentInstance.getReportRunnable( );				reportDocumentInstance.close( );			}		}		// if report runnable is null, then get it from design file		if ( reportRunnable == null )		{			// if only set __document parameter, throw exception directly			if ( documentFile != null && designFile == null )			{				if ( isValidDocument )					throw new ViewerException(							ResourceConstants.GENERAL_EXCEPTION_DOCUMENT_FILE_ERROR,							new String[]{documentFile} );				else					throw new ViewerException(							ResourceConstants.GENERAL_EXCEPTION_DOCUMENT_ACCESS_ERROR,							new String[]{documentFile} );			}			// check if the report file path is valid			if ( !ParameterAccessor.isValidFilePath( designFile ) )			{				throw new ViewerException(						ResourceConstants.GENERAL_EXCEPTION_REPORT_ACCESS_ERROR,						new String[]{designFile} );			}			else			{				// check the design file if exist				File file = new File( designFile );				if ( file.exists( ) )				{					reportRunnable = ReportEngineService.getInstance( )							.openReportDesign( designFile, getModuleOptions( ) );				}				else if ( !ParameterAccessor.isWorkingFolderAccessOnly( ) )				{					InputStream is = null;					URL url = null;					try					{						String reportPath = designFile;						if ( !reportPath.startsWith( "/" ) ) //$NON-NLS-1$							reportPath = "/" + reportPath; //$NON-NLS-1$						url = request.getSession( ).getServletContext( )								.getResource( reportPath );						if ( url != null )							is = url.openStream( );						if ( is != null )							reportRunnable = ReportEngineService.getInstance( )									.openReportDesign( url.toString( ), is,											getModuleOptions( ) );					}					catch ( Exception e )					{					}				}				if ( reportRunnable == null )				{					throw new ViewerException(							ResourceConstants.GENERAL_EXCEPTION_REPORT_FILE_ERROR,							new String[]{designFile} );				}			}		}		if ( reportRunnable != null )		{			design = new BirtViewerReportDesignHandle(					IViewerReportDesignHandle.RPT_RUNNABLE_OBJECT,					reportRunnable );		}		return design;	}