Buggy code:
public class MessageBuilder extends Task { private static final String TAB_STOP = "<seq2seq4repair_space>" ; private static final String PROPERTIES_BOILERPLATE = "###################################################\n" + ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( "#\n" + "#<seq2seq4repair_space>Licensed<seq2seq4repair_space>to<seq2seq4repair_space>the<seq2seq4repair_space>Apache<seq2seq4repair_space>Software<seq2seq4repair_space>Foundation<seq2seq4repair_space>(ASF)<seq2seq4repair_space>under<seq2seq4repair_space>one<seq2seq4repair_space>or<seq2seq4repair_space>more\n" ) + "#<seq2seq4repair_space>contributor<seq2seq4repair_space>license<seq2seq4repair_space>agreements.<seq2seq4repair_space>See<seq2seq4repair_space>the<seq2seq4repair_space>NOTICE<seq2seq4repair_space>file<seq2seq4repair_space>distributed<seq2seq4repair_space>with\n" ) + "#<seq2seq4repair_space>this<seq2seq4repair_space>work<seq2seq4repair_space>for<seq2seq4repair_space>additional<seq2seq4repair_space>information<seq2seq4repair_space>regarding<seq2seq4repair_space>copyright<seq2seq4repair_space>ownership.\n" ) + "#<seq2seq4repair_space>The<seq2seq4repair_space>ASF<seq2seq4repair_space>licenses<seq2seq4repair_space>this<seq2seq4repair_space>file<seq2seq4repair_space>to<seq2seq4repair_space>You<seq2seq4repair_space>under<seq2seq4repair_space>the<seq2seq4repair_space>Apache<seq2seq4repair_space>License,<seq2seq4repair_space>Version<seq2seq4repair_space>2.0\n" ) + "#<seq2seq4repair_space>(the<seq2seq4repair_space>\"License\");<seq2seq4repair_space>you<seq2seq4repair_space>may<seq2seq4repair_space>not<seq2seq4repair_space>use<seq2seq4repair_space>this<seq2seq4repair_space>file<seq2seq4repair_space>except<seq2seq4repair_space>in<seq2seq4repair_space>compliance<seq2seq4repair_space>with\n" ) + "#<seq2seq4repair_space>the<seq2seq4repair_space>License.<seq2seq4repair_space>You<seq2seq4repair_space>may<seq2seq4repair_space>obtain<seq2seq4repair_space>a<seq2seq4repair_space>copy<seq2seq4repair_space>of<seq2seq4repair_space>the<seq2seq4repair_space>License<seq2seq4repair_space>at\n" ) + "#\n" ) + "#<seq2seq4repair_space>http:////www.apache.org//licenses//LICENSE-2.0\n" ) + "#\n" ) + "#<seq2seq4repair_space>Unless<seq2seq4repair_space>required<seq2seq4repair_space>by<seq2seq4repair_space>applicable<seq2seq4repair_space>law<seq2seq4repair_space>or<seq2seq4repair_space>agreed<seq2seq4repair_space>to<seq2seq4repair_space>in<seq2seq4repair_space>writing,<seq2seq4repair_space>software\n" ) + "#<seq2seq4repair_space>distributed<seq2seq4repair_space>under<seq2seq4repair_space>the<seq2seq4repair_space>License<seq2seq4repair_space>is<seq2seq4repair_space>distributed<seq2seq4repair_space>on<seq2seq4repair_space>an<seq2seq4repair_space>\"AS<seq2seq4repair_space>IS\"<seq2seq4repair_space>BASIS,\n" ) + "#<seq2seq4repair_space>WITHOUT<seq2seq4repair_space>WARRANTIES<seq2seq4repair_space>OR<seq2seq4repair_space>CONDITIONS<seq2seq4repair_space>OF<seq2seq4repair_space>ANY<seq2seq4repair_space>KIND,<seq2seq4repair_space>either<seq2seq4repair_space>express<seq2seq4repair_space>or<seq2seq4repair_space>implied.\n" ) + "#<seq2seq4repair_space>See<seq2seq4repair_space>the<seq2seq4repair_space>License<seq2seq4repair_space>for<seq2seq4repair_space>the<seq2seq4repair_space>specific<seq2seq4repair_space>language<seq2seq4repair_space>governing<seq2seq4repair_space>permissions<seq2seq4repair_space>and\n" ) + "#<seq2seq4repair_space>limitations<seq2seq4repair_space>under<seq2seq4repair_space>the<seq2seq4repair_space>License.\n" ) + "#\n" ) + "###################################################\n" ) + "\n" ) + "###################################################\n" ) + "#\n" ) + "#<seq2seq4repair_space>DO<seq2seq4repair_space>NOT<seq2seq4repair_space>EDIT<seq2seq4repair_space>THIS<seq2seq4repair_space>FILE!\n" ) + "#\n" ) + "#<seq2seq4repair_space>Instead,<seq2seq4repair_space>edit<seq2seq4repair_space>messages.xml.<seq2seq4repair_space>The<seq2seq4repair_space>ant<seq2seq4repair_space>MessageBuilder<seq2seq4repair_space>task<seq2seq4repair_space>takes\n" ) + "#<seq2seq4repair_space>messages.xml<seq2seq4repair_space>as<seq2seq4repair_space>input<seq2seq4repair_space>and<seq2seq4repair_space>from<seq2seq4repair_space>it<seq2seq4repair_space>generates<seq2seq4repair_space>this<seq2seq4repair_space>file.\n" ) + "#\n" ) + "###################################################\n" ) ; private static final String REF_GUIDE_BOILERPLATE = "<?xml<seq2seq4repair_space>version=\"1.0\"<seq2seq4repair_space>encoding=\"utf-8\"?>\n" + ( "<!DOCTYPE<seq2seq4repair_space>reference<seq2seq4repair_space>PUBLIC<seq2seq4repair_space>\"-////OASIS////DTD<seq2seq4repair_space>DITA<seq2seq4repair_space>Reference////EN\"\n" + "<seq2seq4repair_space>\"..//dtd//reference.dtd\">\n" ) ; private static final String REF_GUIDE_NOTES = "<!--<seq2seq4repair_space>\n" + ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( ( "Licensed<seq2seq4repair_space>to<seq2seq4repair_space>the<seq2seq4repair_space>Apache<seq2seq4repair_space>Software<seq2seq4repair_space>Foundation<seq2seq4repair_space>(ASF)<seq2seq4repair_space>under<seq2seq4repair_space>one<seq2seq4repair_space>or<seq2seq4repair_space>more\n" + "contributor<seq2seq4repair_space>license<seq2seq4repair_space>agreements.<seq2seq4repair_space>See<seq2seq4repair_space>the<seq2seq4repair_space>NOTICE<seq2seq4repair_space>file<seq2seq4repair_space>distributed<seq2seq4repair_space>with\n" ) + "this<seq2seq4repair_space>work<seq2seq4repair_space>for<seq2seq4repair_space>additional<seq2seq4repair_space>information<seq2seq4repair_space>regarding<seq2seq4repair_space>copyright<seq2seq4repair_space>ownership.\n" ) + "The<seq2seq4repair_space>ASF<seq2seq4repair_space>licenses<seq2seq4repair_space>this<seq2seq4repair_space>file<seq2seq4repair_space>to<seq2seq4repair_space>You<seq2seq4repair_space>under<seq2seq4repair_space>the<seq2seq4repair_space>Apache<seq2seq4repair_space>License,<seq2seq4repair_space>Version<seq2seq4repair_space>2.0\n" ) + "(the<seq2seq4repair_space>\"License\");<seq2seq4repair_space>you<seq2seq4repair_space>may<seq2seq4repair_space>not<seq2seq4repair_space>use<seq2seq4repair_space>this<seq2seq4repair_space>file<seq2seq4repair_space>except<seq2seq4repair_space>in<seq2seq4repair_space>compliance<seq2seq4repair_space>with\n" ) + "the<seq2seq4repair_space>License.<seq2seq4repair_space>You<seq2seq4repair_space>may<seq2seq4repair_space>obtain<seq2seq4repair_space>a<seq2seq4repair_space>copy<seq2seq4repair_space>of<seq2seq4repair_space>the<seq2seq4repair_space>License<seq2seq4repair_space>at<seq2seq4repair_space>\n" ) + "\n" ) + "http:////www.apache.org//licenses//LICENSE-2.0<seq2seq4repair_space>\n" ) + "\n" ) + "Unless<seq2seq4repair_space>required<seq2seq4repair_space>by<seq2seq4repair_space>applicable<seq2seq4repair_space>law<seq2seq4repair_space>or<seq2seq4repair_space>agreed<seq2seq4repair_space>to<seq2seq4repair_space>in<seq2seq4repair_space>writing,<seq2seq4repair_space>software<seq2seq4repair_space>\n" ) + "distributed<seq2seq4repair_space>under<seq2seq4repair_space>the<seq2seq4repair_space>License<seq2seq4repair_space>is<seq2seq4repair_space>distributed<seq2seq4repair_space>on<seq2seq4repair_space>an<seq2seq4repair_space>\"AS<seq2seq4repair_space>IS\"<seq2seq4repair_space>BASIS,<seq2seq4repair_space>\n" ) + "WITHOUT<seq2seq4repair_space>WARRANTIES<seq2seq4repair_space>OR<seq2seq4repair_space>CONDITIONS<seq2seq4repair_space>OF<seq2seq4repair_space>ANY<seq2seq4repair_space>KIND,<seq2seq4repair_space>either<seq2seq4repair_space>express<seq2seq4repair_space>or<seq2seq4repair_space>implied.<seq2seq4repair_space>\n" ) + "See<seq2seq4repair_space>the<seq2seq4repair_space>License<seq2seq4repair_space>for<seq2seq4repair_space>the<seq2seq4repair_space>specific<seq2seq4repair_space>language<seq2seq4repair_space>governing<seq2seq4repair_space>permissions<seq2seq4repair_space>and<seq2seq4repair_space>\n" ) + "limitations<seq2seq4repair_space>under<seq2seq4repair_space>the<seq2seq4repair_space>License.\n" ) + "-->\n" ) + "\n" ) + "<!--<seq2seq4repair_space>\n" ) + "NOTE:<seq2seq4repair_space>this<seq2seq4repair_space>file<seq2seq4repair_space>is<seq2seq4repair_space>generated<seq2seq4repair_space>by<seq2seq4repair_space>the<seq2seq4repair_space>MessageBuilder<seq2seq4repair_space>task<seq2seq4repair_space>as<seq2seq4repair_space>part<seq2seq4repair_space>of<seq2seq4repair_space>a\n" ) + "Derby<seq2seq4repair_space>build.<seq2seq4repair_space>Please<seq2seq4repair_space>do<seq2seq4repair_space>not<seq2seq4repair_space>hand-edit<seq2seq4repair_space>this<seq2seq4repair_space>file.<seq2seq4repair_space>Instead,<seq2seq4repair_space>please<seq2seq4repair_space>edit\n" ) + "the<seq2seq4repair_space>corresponding<seq2seq4repair_space>text<seq2seq4repair_space>in<seq2seq4repair_space>messages.xml<seq2seq4repair_space>and//or<seq2seq4repair_space>MessageBuilder.\n" ) + "-->\n" ) ; private String _xmlSourceFile ; private String _propertiesTargetFile ; private String _ditaTargetFile ; public static final class XMLWriter { private boolean _vacuous ; private FileWriter _fw ; private PrintWriter _pw ; private ArrayList _tagStack ; public XMLWriter ( ) { } public XMLWriter ( File file ) throws IOException { } public void flush ( ) throws IOException { } public void close ( ) throws IOException { } public void writeEmptyTag ( String tag ) throws IOException { } public void writeEmptyTag ( String tag , String attributes ) throws IOException { } public void beginTag ( String tag ) throws IOException { } public void beginTag ( String tag , String attributes ) throws IOException { } public void endTag ( ) throws IOException { } public void writeTextElement ( String tag , String text ) throws IOException { } public void writeTextElement ( String tag , String attributes , String text ) throws IOException { } public void indent ( ) throws IOException { } public void println ( String text ) throws IOException { } } public MessageBuilder ( ) { } public void setXmlSourceFile ( String fileName ) { } public void setPropertiesTargetFile ( String fileName ) { } public void setDitaTargetFile ( String fileName ) { } public void execute ( ) throws BuildException { } private void processMessages ( File input , PrintWriter propertiesPW , MessageBuilder . XMLWriter ditaWriter ) throws Exception { DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; Document doc = builder . parse ( input ) ; Element root = doc . getDocumentElement ( ) ; NodeList sections = root . getElementsByTagName ( "section" ) ; propertiesPW . println ( MessageBuilder . PROPERTIES_BOILERPLATE ) ; ditaWriter . println ( MessageBuilder . REF_GUIDE_BOILERPLATE ) ; ditaWriter . beginTag ( "reference" , "id=\"rrefexcept71493\"<seq2seq4repair_space>xml:lang=\"en-us\"" ) ; { ditaWriter . println ( MessageBuilder . REF_GUIDE_NOTES ) ; ditaWriter . writeTextElement ( "title" , "SQL<seq2seq4repair_space>error<seq2seq4repair_space>messages<seq2seq4repair_space>and<seq2seq4repair_space>exceptions" ) ; ditaWriter . beginTag ( "refbody" ) ; { ditaWriter . beginTag ( "section" ) ; { <START_BUG> ditaWriter . writeTextElement ( "p" , ( "The<seq2seq4repair_space>following<seq2seq4repair_space>tables<seq2seq4repair_space>list<seq2seq4repair_space><i>SQLStates<//i><seq2seq4repair_space>for<seq2seq4repair_space>exceptions.<seq2seq4repair_space>Exceptions<seq2seq4repair_space>" + "that<seq2seq4repair_space>begin<seq2seq4repair_space>with<seq2seq4repair_space>an<seq2seq4repair_space><i>X<//i><seq2seq4repair_space>are<seq2seq4repair_space>specific<seq2seq4repair_space>to<seq2seq4repair_space><ph<seq2seq4repair_space>conref=\"refconrefs.dita#prod//productshortname\"><//ph>." ) ) ; <END_BUG> } ditaWriter . endTag ( ) ; ditaWriter . beginTag ( "section" ) ; { processSections ( propertiesPW , ditaWriter , sections ) ; } ditaWriter . endTag ( ) ; } ditaWriter . endTag ( ) ; } ditaWriter . endTag ( ) ; } private void processSections ( PrintWriter propertiesPW , MessageBuilder . XMLWriter ditaWriter , NodeList nodes ) throws Exception { } private void processSection ( PrintWriter propertiesPW , MessageBuilder . XMLWriter ditaWriter , Element section ) throws Exception { } private void processFamily ( PrintWriter propertiesPW , MessageBuilder . XMLWriter ditaWriter , Element family ) throws Exception { } private void processMessage ( PrintWriter propertiesPW , MessageBuilder . XMLWriter ditaWriter , Element message ) throws Exception { } private String getSQLState ( String name ) { } private String [ ] getArgs ( Element message ) throws Exception { } private int countParameters ( String text ) { } private String plugInArgs ( String message , String [ ] rawArgs ) { } private void echo ( String text ) { } private void finishWriting ( FileWriter fw , PrintWriter pw ) throws IOException { } private Element getFirstChild ( Element node , String childName ) throws Exception { } private String squeezeText ( Element node ) throws Exception { } private static String replaceSpecialChars ( String input ) { } private static String escapePropertiesText ( String input ) { } private static String escapeTextWithAQuote ( String input ) { } }

Fix:
ditaWriter . writeTextElement ( "p" , ( "The<seq2seq4repair_space>following<seq2seq4repair_space>tables<seq2seq4repair_space>list<seq2seq4repair_space><i>SQLStates<//i><seq2seq4repair_space>for<seq2seq4repair_space>exceptions.<seq2seq4repair_space>Exceptions<seq2seq4repair_space>" + "that<seq2seq4repair_space>begin<seq2seq4repair_space>with<seq2seq4repair_space>an<seq2seq4repair_space><i>X<//i><seq2seq4repair_space>are<seq2seq4repair_space>specific<seq2seq4repair_space>to<seq2seq4repair_space><ph<seq2seq4repair_space>conref=\"..//conrefs.dita#prod//productshortname\"><//ph>." ) ) ;