Buggy code:
public class SearchFiles { private static class OneNormsReader extends FilterIndexReader { private String field ; public OneNormsReader ( IndexReader in , String field ) { } public byte [ ] norms ( String field ) throws IOException { } } private SearchFiles ( ) { } public static void main ( String [ ] args ) throws Exception { String usage = "Usage:\tjava<seq2seq4repair_space>org.apache.lucene.demo.SearchFiles<seq2seq4repair_space>[-index<seq2seq4repair_space>dir]<seq2seq4repair_space>[-field<seq2seq4repair_space>f]<seq2seq4repair_space>[-repeat<seq2seq4repair_space>n]<seq2seq4repair_space>[-queries<seq2seq4repair_space>file]<seq2seq4repair_space>[-raw]<seq2seq4repair_space>[-norms<seq2seq4repair_space>field]<seq2seq4repair_space>[-paging<seq2seq4repair_space>hitsPerPage]" ; usage += "\n\tSpecify<seq2seq4repair_space>\'false\'<seq2seq4repair_space>for<seq2seq4repair_space>hitsPerPage<seq2seq4repair_space>to<seq2seq4repair_space>use<seq2seq4repair_space>streaming<seq2seq4repair_space>instead<seq2seq4repair_space>of<seq2seq4repair_space>paging<seq2seq4repair_space>search." ; if ( ( ( args . length ) > 0 ) && ( ( "-h" . equals ( args [ 0 ] ) ) || ( "-help" . equals ( args [ 0 ] ) ) ) ) { System . out . println ( usage ) ; System . exit ( 0 ) ; } String index = "index" ; String field = "contents" ; String queries = null ; int repeat = 0 ; boolean raw = false ; String normsField = null ; boolean paging = true ; int hitsPerPage = 10 ; for ( int i = 0 ; i < ( args . length ) ; i ++ ) { if ( "-index" . equals ( args [ i ] ) ) { index = args [ ( i + 1 ) ] ; i ++ ; } else if ( "-field" . equals ( args [ i ] ) ) { field = args [ ( i + 1 ) ] ; i ++ ; } else if ( "-queries" . equals ( args [ i ] ) ) { queries = args [ ( i + 1 ) ] ; i ++ ; } else if ( "-repeat" . equals ( args [ i ] ) ) { repeat = Integer . parseInt ( args [ ( i + 1 ) ] ) ; i ++ ; } else if ( "-raw" . equals ( args [ i ] ) ) { raw = true ; } else if ( "-norms" . equals ( args [ i ] ) ) { normsField = args [ ( i + 1 ) ] ; i ++ ; } else if ( "-paging" . equals ( args [ i ] ) ) { if ( args [ ( i + 1 ) ] . equals ( "false" ) ) { paging = false ; } else { hitsPerPage = Integer . parseInt ( args [ ( i + 1 ) ] ) ; if ( hitsPerPage == 0 ) { paging = false ; } } i ++ ; } } IndexReader reader = IndexReader . open ( FSDirectory . open ( new File ( index ) ) , true ) ; if ( normsField != null ) reader = new SearchFiles . OneNormsReader ( reader , normsField ) ; Searcher searcher = new org . apache . lucene . search . IndexSearcher ( reader ) ; Analyzer analyzer = new org . apache . lucene . analysis . standard . StandardAnalyzer ( Version . LUCENE_CURRENT ) ; BufferedReader in = null ; if ( queries != null ) { in = new BufferedReader ( new FileReader ( queries ) ) ; } else { in = new BufferedReader ( new InputStreamReader ( System . in , "UTF-8" ) ) ; } <START_BUG> QueryParser parser = new QueryParser ( field , analyzer ) ; <END_BUG> while ( true ) { if ( queries == null ) System . out . println ( "Enter<seq2seq4repair_space>query:<seq2seq4repair_space>" ) ; String line = in . readLine ( ) ; if ( ( line == null ) || ( ( line . length ( ) ) == ( - 1 ) ) ) break ; line = line . trim ( ) ; if ( ( line . length ( ) ) == 0 ) break ; Query query = parser . parse ( line ) ; System . out . println ( ( "Searching<seq2seq4repair_space>for:<seq2seq4repair_space>" + ( query . toString ( field ) ) ) ) ; if ( repeat > 0 ) { Date start = new Date ( ) ; for ( int i = 0 ; i < repeat ; i ++ ) { searcher . search ( query , null , 100 ) ; } Date end = new Date ( ) ; System . out . println ( ( ( "Time:<seq2seq4repair_space>" + ( ( end . getTime ( ) ) - ( start . getTime ( ) ) ) ) + "ms" ) ) ; } if ( paging ) { SearchFiles . doPagingSearch ( in , searcher , query , hitsPerPage , raw , ( queries == null ) ) ; } else { SearchFiles . doStreamingSearch ( searcher , query ) ; } } reader . close ( ) ; } public static void doStreamingSearch ( final Searcher searcher , Query query ) throws IOException { } public static void doPagingSearch ( BufferedReader in , Searcher searcher , Query query , int hitsPerPage , boolean raw , boolean interactive ) throws IOException { } }

Fix:
QueryParser parser = new QueryParser ( Version . LUCENE_CURRENT , field , analyzer ) ;