}  String baseURL = null; if ( context instanceof HTMLRenderContext ) { baseURL = ( (HTMLRenderContext) context ).getBaseURL( ); } if ( context instanceof PDFRenderContext ) { baseURL = ( (PDFRenderContext) context ).getBaseURL( );
	protected String buildBookmarkAction( IAction action, Object context )	{		if ( action == null || context == null )			return null;		StringBuffer link = new StringBuffer( );		boolean realBookmark = false;		if ( this.document != null )		{			long pageNumber = this.document					.getPageNumber( action.getBookmark( ) );			realBookmark = ( pageNumber == this.page && !isEmbeddable );		}		String bookmark = action.getBookmark( );		try		{			bookmark = URLEncoder.encode( bookmark,					ParameterAccessor.UTF_8_ENCODE );		}		catch ( UnsupportedEncodingException e )		{			// Does nothing		}		String baseURL = null;		if ( context instanceof HTMLRenderContext )		{			baseURL = ( (HTMLRenderContext) context ).getBaseURL( );		}		if ( context instanceof PDFRenderContext )		{			baseURL = ( (PDFRenderContext) context ).getBaseURL( );		}		link.append( baseURL );		link.append( ParameterAccessor.QUERY_CHAR );		// if the document is not null, then use it		if ( document != null )		{			link.append( ParameterAccessor.PARAM_REPORT_DOCUMENT );			link.append( ParameterAccessor.EQUALS_OPERATOR );			String documentName = document.getName( );			try			{				documentName = URLEncoder.encode( documentName,						ParameterAccessor.UTF_8_ENCODE );			}			catch ( UnsupportedEncodingException e )			{				// Does nothing			}			link.append( documentName );		}		else if ( action.getReportName( ) != null				&& action.getReportName( ).length( ) > 0 )		{			link.append( ParameterAccessor.PARAM_REPORT );			link.append( ParameterAccessor.EQUALS_OPERATOR );			String reportName = action.getReportName( );			try			{				reportName = URLEncoder.encode( reportName,						ParameterAccessor.UTF_8_ENCODE );			}			catch ( UnsupportedEncodingException e )			{				// do nothing			}			link.append( reportName );		}		else		{			// its an iternal bookmark			return "#" + action.getActionString( ); //$NON-NLS-1$		}		if ( locale != null )		{			link.append( ParameterAccessor.getQueryParameterString(					ParameterAccessor.PARAM_LOCALE, locale.toString( ) ) );		}		if ( isRtl )		{			link.append( ParameterAccessor.getQueryParameterString(					ParameterAccessor.PARAM_RTL, String.valueOf( isRtl ) ) );		}		// add isMasterPageContent		link.append( ParameterAccessor.getQueryParameterString(				ParameterAccessor.PARAM_MASTERPAGE, String						.valueOf( this.isMasterPageContent ) ) );		if ( realBookmark )		{			link.append( "#" ); //$NON-NLS-1$			link.append( bookmark );		}		else		{			link.append( ParameterAccessor.getQueryParameterString(					ParameterAccessor.PARAM_BOOKMARK, bookmark ) );		}		return link.toString( );	}