Buggy code:
private static final String ERROR = "ERROR" ; private static final String ERROR_TAG = "error" ; private static final String EXCEPTION = "exception" ; private static final String EXTRA_PROBLEM_TAG = "extra_problem" ; private static final String EXTRA_PROBLEMS = "extra_problems" ; private static final HashtableOfInt FIELD_TABLE = new HashtableOfInt ( ) ; private static final String KEY = "key" ; private static final String MESSAGE = "message" ; private static final String NUMBER_OF_CLASSFILES = "number_of_classfiles" ; private static final String NUMBER_OF_ERRORS = "errors" ; private static final String NUMBER_OF_LINES = "number_of_lines" ; private static final String NUMBER_OF_PROBLEMS = "problems" ; private static final String NUMBER_OF_TASKS = "tasks" ; private static final String NUMBER_OF_WARNINGS = "warnings" ; private static final String OPTION = "option" ; private static final String OPTIONS = "options" ; private static final String OUTPUT = "output" ; private static final String PACKAGE = "package" ; private static final String PATH = "path" ; private static final String PROBLEM_ARGUMENT = "argument" ; private static final String PROBLEM_ARGUMENT_VALUE = "value" ; private static final String PROBLEM_ARGUMENTS = "arguments" ; private static final String PROBLEM_CATEGORY_ID = "categoryID" ; private static final String ID = "id" ; private static final String PROBLEM_ID = "problemID" ; private static final String PROBLEM_LINE = "line" ; private static final String PROBLEM_OPTION_KEY = "optionKey" ; private static final String PROBLEM_MESSAGE = "message" ; private static final String PROBLEM_SEVERITY = "severity" ; private static final String PROBLEM_SOURCE_END = "charEnd" ; private static final String PROBLEM_SOURCE_START = "charStart" ; private static final String PROBLEM_SUMMARY = "problem_summary" ; private static final String PROBLEM_TAG = "problem" ; private static final String PROBLEMS = "problems" ; private static final String SOURCE = "source" ; private static final String SOURCE_CONTEXT = "source_context" ; private static final String SOURCE_END = "sourceEnd" ; private static final String SOURCE_START = "sourceStart" ; private static final String SOURCES = "sources" ; private static final String STATS = "stats" ; private static final String TASK = "task" ; private static final String TASKS = "tasks" ; private static final String TIME = "time" ; private static final String VALUE = "value" ; private static final String WARNING = "WARNING" ; public static final int XML = 1 ; private static final String XML_DTD_DECLARATION = "<!DOCTYPE<seq2seq4repair_space>compiler<seq2seq4repair_space>PUBLIC<seq2seq4repair_space>\"-////Eclipse.org////DTD<seq2seq4repair_space>Eclipse<seq2seq4repair_space>JDT<seq2seq4repair_space>3.2.003<seq2seq4repair_space>Compiler////EN\"<seq2seq4repair_space>\"http:////www.eclipse.org//jdt//core//compiler_32_003.dtd\">" ; public Logger ( Main main , PrintWriter out , PrintWriter err ) { } public String buildFileName ( String outputPath , String relativeFileName ) { } public void close ( ) { } public void compiling ( ) { } private void endLoggingExtraProblems ( ) { } private void endLoggingProblems ( ) { } public void endLoggingSource ( ) { } public void endLoggingSources ( ) { } public void endLoggingTasks ( ) { } private void endTag ( String name ) { } private String errorReportSource ( CategorizedProblem problem , char [ ] unitSource , int bits ) { } private void extractContext ( CategorizedProblem problem , char [ ] unitSource ) { } public void flush ( ) { } private String getFieldName ( int id ) { } private String getProblemOptionKey ( int problemID ) { } public void logAverage ( ) { } public void logClassFile ( boolean generatePackagesStructure , String outputPath , String relativeFileName ) { } public void logClasspath ( FileSystem . Classpath [ ] classpaths ) { } public void logCommandLineArguments ( String [ ] commandLineArguments ) { } public void logException ( Exception e ) { StringWriter writer = new StringWriter ( ) ; PrintWriter printWriter = new PrintWriter ( writer ) ; e . printStackTrace ( printWriter ) ; printWriter . flush ( ) ; printWriter . close ( ) ; <START_BUG> final String stackTrace = writer . getBuffer ( ) . toString ( ) ; <END_BUG> if ( ( ( this . tagBits ) & ( Main . Logger . XML ) ) != 0 ) { LineNumberReader reader = new LineNumberReader ( new StringReader ( stackTrace ) ) ; String line ; int i = 0 ; StringBuffer buffer = new StringBuffer ( ) ; String message = e . getMessage ( ) ; if ( message != null ) { buffer . append ( message ) . append ( Util . LINE_SEPARATOR ) ; } try { while ( ( ( line = reader . readLine ( ) ) != null ) && ( i < 4 ) ) { buffer . append ( line ) . append ( Util . LINE_SEPARATOR ) ; i ++ ; } reader . close ( ) ; } catch ( IOException e1 ) { } message = buffer . toString ( ) ; this . parameters . put ( Main . Logger . MESSAGE , message ) ; this . parameters . put ( Main . Logger . CLASS , e . getClass ( ) ) ; printTag ( Main . Logger . EXCEPTION , this . parameters , true , true ) ; } String message = e . getMessage ( ) ; if ( message == null ) { this . printlnErr ( stackTrace ) ; } else { this . printlnErr ( message ) ; } } private void logExtraProblem ( CategorizedProblem problem , int localErrorCount , int globalErrorCount ) { } public void loggingExtraProblems ( Main currentMain ) { } public void logIncorrectVMVersionForAnnotationProcessing ( ) { } public void logNoClassFileCreated ( String outputDir , String relativeFileName , IOException e ) { } public void logNumberOfClassFilesGenerated ( int exportedClassFilesCounter ) { } public void logOptions ( Map options ) { } public void logPendingError ( String error ) { } private void logProblem ( CategorizedProblem problem , int localErrorCount , int globalErrorCount , char [ ] unitSource ) { } public int logProblems ( CategorizedProblem [ ] problems , char [ ] unitSource , Main currentMain ) { } public void logProblemsSummary ( int globalProblemsCount , int globalErrorsCount , int globalWarningsCount , int globalTasksCount ) { } public void logProgress ( ) { }

Fix:
final String stackTrace = writer . toString ( ) ;