Buggy code:
private static final String DEFAULT_COMMIT = "yes" ; private static final String DEFAULT_OPTIMIZE = "no" ; private static final String DEFAULT_OUT = "no" ; private static final String DEFAULT_AUTO = "no" ; private static final String DEFAULT_RECURSIVE = "0" ; private static final int DEFAULT_WEB_DELAY = 10 ; private static final int MAX_WEB_DEPTH = 10 ; private static final String DEFAULT_CONTENT_TYPE = "application//xml" ; private static final String DEFAULT_FILE_TYPES = "xml,json,csv,pdf,doc,docx,ppt,pptx,xls,xlsx,odt,odp,ods,ott,otp,ots,rtf,htm,html,txt,log" ; static final String DATA_MODE_FILES = "files" ; static final String DATA_MODE_ARGS = "args" ; static final String DATA_MODE_STDIN = "stdin" ; static final String DATA_MODE_WEB = "web" ; static final String DEFAULT_DATA_MODE = SimplePostTool . DATA_MODE_FILES ; boolean auto = false ; int recursive = 0 ; int delay = 0 ; String fileTypes ; URL solrUrl ; OutputStream out = null ; String type ; String mode ; boolean commit ; boolean optimize ; String [ ] args ; private int currentDepth ; static HashMap < String , String > mimeMap ; SimplePostTool . GlobFileFilter globFileFilter ; List < LinkedHashSet < URL > > backlog = new ArrayList < LinkedHashSet < URL > > ( ) ; Set < URL > visited = new HashSet < URL > ( ) ; static final Set < String > DATA_MODES = new HashSet < String > ( ) ; static final String USAGE_STRING_SHORT = "Usage:<seq2seq4repair_space>java<seq2seq4repair_space>[SystemProperties]<seq2seq4repair_space>-jar<seq2seq4repair_space>post.jar<seq2seq4repair_space>[-h|-]<seq2seq4repair_space>[<file|folder|url|arg><seq2seq4repair_space>[<file|folder|url|arg>...]]" ; static boolean mockMode = false ; static SimplePostTool . PageFetcher pageFetcher ; public static void main ( String [ ] args ) { } public void execute ( ) { } private void displayTiming ( long millis ) { } protected static SimplePostTool parseArgsAndInit ( String [ ] args ) { } public SimplePostTool ( String mode , URL url , boolean auto , String type , int recursive , int delay , String fileTypes , OutputStream out , boolean commit , boolean optimize , String [ ] args ) { } public SimplePostTool ( ) { } private void doFilesMode ( ) { } private void doArgsMode ( ) { } private int doWebMode ( ) { } private void doStdinMode ( ) { } private void reset ( ) { } private static void usageShort ( ) { } private static void usage ( ) { } public int postFiles ( String [ ] args , int startIndexInArgs , OutputStream out , String type ) { } public int postFiles ( File [ ] files , int startIndexInArgs , OutputStream out , String type ) { } private int postDirectory ( File dir , OutputStream out , String type ) { } int postFiles ( File [ ] files , OutputStream out , String type ) { } public int postWebPages ( String [ ] args , int startIndexInArgs , OutputStream out ) { } protected static String normalizeUrlEnding ( String link ) { } protected int webCrawl ( int level , OutputStream out ) { } protected byte [ ] inputStreamToByteArray ( InputStream is ) throws IOException { } protected String computeFullUrl ( URL baseUrl , String link ) { } protected boolean typeSupported ( String type ) { } protected static boolean isOn ( String property ) { } static void warn ( String msg ) { } static void info ( String msg ) { } static void fatal ( String msg ) { } public void commit ( ) { } public void optimize ( ) { } public static String appendParam ( String url , String param ) { } public void postFile ( File file , OutputStream output , String type ) { } protected static URL appendUrlPath ( URL url , String append ) throws MalformedURLException { } protected static String guessType ( File file ) { } public static void doGet ( String url ) { } public static void doGet ( URL url ) { } public boolean postData ( InputStream data , Integer length , OutputStream output , String type , URL url ) { } public static InputStream stringToStream ( String s ) { } private static void pipe ( InputStream source , OutputStream dest ) throws IOException { } public SimplePostTool . GlobFileFilter getFileFilterFromFileTypes ( String fileTypes ) { } public static NodeList getNodesFromXP ( Node n , String xpath ) throws XPathExpressionException { } public static String getXP ( Node n , String xpath , boolean concatAll ) throws XPathExpressionException { NodeList nodes = SimplePostTool . getNodesFromXP ( n , xpath ) ; <START_BUG> StringBuffer sb = new StringBuffer ( ) ; <END_BUG> if ( ( nodes . getLength ( ) ) > 0 ) { for ( int i = 0 ; i < ( nodes . getLength ( ) ) ; i ++ ) { sb . append ( ( ( nodes . item ( i ) . getNodeValue ( ) ) + "<seq2seq4repair_space>" ) ) ; if ( ! concatAll ) break ; } return sb . toString ( ) . trim ( ) ; } else return "" ; } public static Document makeDom ( String in , String inputEncoding ) throws IOException , ParserConfigurationException , SAXException { } class GlobFileFilter implements FileFilter { private String _pattern ; private Pattern p ; public GlobFileFilter ( String pattern , boolean isRegex ) { } @ Override public boolean accept ( File file ) { } } class PageFetcher { Map < String , List < String > > robotsCache ; final String DISALLOW = "Disallow:" ; public PageFetcher ( ) { } public SimplePostTool . PageFetcherResult readPageFromUrl ( URL u ) { } public boolean isDisallowedByRobots ( URL url ) { } protected List < String > parseRobotsTxt ( InputStream is ) throws IOException { } protected Set < URL > getLinksFromWebPage ( URL u , InputStream is , String type , URL postUrl ) { } } public class PageFetcherResult { int httpStatus = 200 ; String contentType = "text//html" ; URL redirectUrl = null ; byte [ ] content ; } }

Fix:
StringBuilder sb = new StringBuilder ( ) ;