@ SuppressWarnings ( "static-method" ) protected String buildContent ( String description , Charset charset ) throws IOException { final StringBuilder fullContent = new StringBuilder ( ) ; // User message if ( ! Strings . isEmpty ( description ) ) { fullContent . append ( description ) ; fullContent . append ( Messages . SubmitEclipseLogWizard_8 ) ; } // Log final SARLEclipsePlugin plugin = SARLEclipsePlugin . getDefault ( ) ; plugin . getLog ( ) . log ( plugin . createStatus ( IStatus . INFO , Messages . SubmitEclipseLogWizard_12 ) ) ; fullContent . append ( Messages . SubmitEclipseLogWizard_9 ) ; final String filename = Platform . getLogFileLocation ( ) . toOSString ( ) ; final File log = new File ( filename ) ; if ( ! log . exists ( ) ) { throw new IOException ( "Unable to find the log file" ) ; //$NON-NLS-1$ } final List < String > logLines = Files . readLines ( log , charset ) ; int logStartIndex = - 1 ; for ( int i = logLines . size ( ) - 1 ; logStartIndex == - 1 && i >= 0 ; -- i ) { final String line = logLines . get ( i ) ; if ( line . startsWith ( "!SESSION" ) ) { //$NON-NLS-1$ logStartIndex = i ; } } for ( int i = logStartIndex ; i < logLines . size ( ) ; ++ i ) { fullContent . append ( logLines . get ( i ) ) ; fullContent . append ( Messages . SubmitEclipseLogWizard_8 ) ; } // Properties fullContent . append ( Messages . SubmitEclipseLogWizard_10 ) ; for ( final Entry < Object , Object > entry : System . getProperties ( ) . entrySet ( ) ) { fullContent . append ( Objects . toString ( entry . getKey ( ) ) ) ; fullContent . append ( Messages . SubmitEclipseLogWizard_11 ) ; fullContent . append ( Objects . toString ( entry . getValue ( ) ) ) ; fullContent . append ( Messages . SubmitEclipseLogWizard_8 ) ; } fullContent . append ( Messages . SubmitEclipseLogWizard_13 ) ; return fullContent . toString ( ) ; }
Build the issue content .