StringBuffer errMsg = new StringBuffer( );   String lastMessage = ""; String currentMessage = null; do { currentMessage =  ex.getLocalizedMessage( );  if ( !currentMessage.equals( lastMessage ) ) { lastMessage = currentMessage; errMsg.append( currentMessage ); errMsg.append( (char) Character.LINE_SEPARATOR ); } ex = ex.getCause( ); } while ( ex != null && !ex.getClass( ).getName( ).startsWith( "java.lang" ) );  addErrorMsg( errMsg.toString( ) );
ReportElementHandle item = getItemDesign(); addException(item, ex);
	public void addException( Throwable ex )	{		StringBuffer errMsg = new StringBuffer( );		// Loops to add the error messages except those system-defined		// exceptions. Skip redundant message.		String lastMessage = "";		String currentMessage = null;		do		{		    currentMessage =  ex.getLocalizedMessage( );		    // skip redundant messages		    if ( !currentMessage.equals( lastMessage ) )		    {		        lastMessage = currentMessage;		        errMsg.append( currentMessage );		        errMsg.append( (char) Character.LINE_SEPARATOR );		    }			ex = ex.getCause( );		} while ( ex != null				&& !ex.getClass( ).getName( ).startsWith( "java.lang" )				);//$NON-NLS-1$			addErrorMsg( errMsg.toString( ) );	}