Buggy code:
private static final String PROBLEM_ARGUMENTS = "arguments" ; private static final String PROBLEM_ID = "id" ; private static final String PROBLEM_LINE = "line" ; private static final String PROBLEM_MESSAGE = "message" ; private static final String PROBLEM_SEVERITY = "severity" ; private static final String PROBLEM_SOURCE_START = "charStart" ; private static final String PROBLEM_SOURCE_END = "charEnd" ; 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" ; private static final String XML_HEADER = "<?xml<seq2seq4repair_space>version=\"1.0\"<seq2seq4repair_space>encoding=\"UTF-8\"?>" ; private static final String XML_DTD_DECLARATION = "<!DOCTYPE<seq2seq4repair_space>compiler<seq2seq4repair_space>SYSTEM<seq2seq4repair_space>\"compiler.dtd\">" ; private static final HashMap FIELD_TABLE = new HashMap ( ) ; private static void appendEscapedChar ( StringBuffer buffer , char c ) { } private static String getEscaped ( String s ) { } private static String getReplacement ( char c ) { } private PrintWriter err ; boolean isXml ; private PrintWriter log ; private PrintWriter out ; private int tab ; private HashMap parameters ; public Logger ( PrintWriter out , PrintWriter err ) { } public String buildFileName ( String outputPath , String relativeFileName ) { } public void close ( ) { } public void compiling ( ) { } private void endLoggingProblems ( ) { } public void endLoggingSource ( ) { } public void endLoggingSources ( ) { } public void endLoggingTasks ( ) { } public void endTag ( String name ) { } private void extractContext ( IProblem problem , char [ ] unitSource ) { } private String getFieldName ( int id ) { } public void flush ( ) { } public void logAverage ( long [ ] times , long lineCount ) { } public void logClasspath ( String [ ] classpaths ) { } public void logClassFile ( boolean generatePackagesStructure , String outputPath , String relativeFileName ) { } public void logCommandLineArguments ( String [ ] commandLineArguments ) { } public void logException ( Exception e ) { } public void logIncorrectClasspath ( String wrongClasspath ) { } public void logNoClassFileCreated ( String fileName ) { } public void logNoClasspath ( ) { } public void logNumberOfClassFilesGenerated ( int exportedClassFilesCounter ) { } public void logOptions ( Map options ) { } private void logProblem ( IProblem problem , int localErrorCount , int globalErrorCount , char [ ] unitSource ) { } public void logProblemsSummary ( int globalProblemsCount , int globalErrorsCount , int globalWarningsCount , int globalTasksCount ) { } public int logProblems ( IProblem [ ] problems , char [ ] unitSource , Main currentMain ) { } public void logProgress ( ) { } public void logRepetition ( int i , int repetitions ) { } public void printStats ( Main main ) { } public void logTiming ( long time , long lineCount ) { } public void logUsage ( String usage ) { } public void logVersion ( ) { } public void logWrongJDK ( ) { } private void logXmlProblem ( IProblem problem , char [ ] unitSource ) { } private void logXmlTask ( IProblem problem , char [ ] unitSource ) { } private void printErr ( String s ) { } private void printlnErr ( String s ) { } private void printlnOut ( String s ) { } public void printNewLine ( ) { } private void printOut ( char c ) { } public void printTag ( String name , HashMap params , boolean insertNewLine , boolean closeTag ) { } public void setLog ( String logFileName ) throws InvalidInputException { try { this . log = new PrintWriter ( new FileOutputStream ( logFileName , false ) ) ; int index = logFileName . lastIndexOf ( '.' ) ; <START_BUG> if ( index != 0 ) { <END_BUG> if ( logFileName . substring ( index ) . toLowerCase ( ) . equals ( ".xml" ) ) { this . isXml = true ; this . log . println ( Main . Logger . XML_HEADER ) ; this . log . println ( Main . Logger . XML_DTD_DECLARATION ) ; this . tab = 0 ; parameters . clear ( ) ; parameters . put ( Main . Logger . COMPILER_NAME , Main . bind ( "compiler.name" ) ) ; parameters . put ( Main . Logger . COMPILER_VERSION , Main . bind ( "compiler.version" ) ) ; parameters . put ( Main . Logger . COMPILER_COPYRIGHT , Main . bind ( "compiler.copyright" ) ) ; this . printTag ( Main . Logger . COMPILER , parameters , true , false ) ; } } } catch ( FileNotFoundException e ) { throw new InvalidInputException ( Main . bind ( "configure.cannotOpenLog" ) ) ; } } private void startLoggingProblems ( int errors , int warnings ) { } public void startLoggingSource ( CompilationResult compilationResult ) { } public void startLoggingSources ( ) { } public void startLoggingTasks ( int tasks ) { } } public static ResourceBundle bundle ; public static final String bundleName = "org.eclipse.jdt.internal.compiler.batch.messages" ; public String [ ] classpaths ; public String destinationPath ; public String [ ] encodings ; public Main . Logger logger ; public int exportedClassFilesCounter ; public String [ ] filenames ; public boolean generatePackagesStructure ; public int globalErrorsCount ; public int globalTasksCount ; public int globalProblemsCount ; public int globalWarningsCount ; public long lineCount ; public String log ; public boolean noWarn = false ; public Map options ; public CompilerOptions compilerOptions ;

Fix:
if ( index != ( - 1 ) ) {