Buggy code:
class SearchFiles { private static class OneNormsReader extends FilterIndexReader { private String field ; public OneNormsReader ( IndexReader in , String field ) { } public byte [ ] norms ( String field ) throws IOException { } } public static void main ( String [ ] args ) throws Exception { String usage = "Usage:<seq2seq4repair_space>java<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]" ; 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 ; 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 ++ ; } } IndexReader reader = IndexReader . open ( index ) ; if ( normsField != null ) reader = new SearchFiles . OneNormsReader ( reader , normsField ) ; Searcher searcher = new org . apache . lucene . search . IndexSearcher ( reader ) ; Analyzer analyzer = new StandardAnalyzer ( ) ; BufferedReader in = null ; if ( queries != null ) { in = new BufferedReader ( new FileReader ( queries ) ) ; } else { <START_BUG> in = new BufferedReader ( new InputStreamReader ( System . class , "UTF-8" ) ) ; <END_BUG> } while ( true ) { if ( queries == null ) System . out . print ( "Query:<seq2seq4repair_space>" ) ; String line = in . readLine ( ) ; if ( ( line == null ) || ( ( line . length ( ) ) == ( - 1 ) ) ) break ; Query query = QueryParser . parse ( line , field , analyzer ) ; System . out . println ( ( "Searching<seq2seq4repair_space>for:<seq2seq4repair_space>" + ( query . toString ( field ) ) ) ) ; Hits hits = searcher . search ( query ) ; if ( repeat > 0 ) { Date start = new Date ( ) ; for ( int i = 0 ; i < repeat ; i ++ ) { hits = searcher . search ( query ) ; } Date end = new Date ( ) ; System . out . println ( ( ( "Time:<seq2seq4repair_space>" + ( ( end . getTime ( ) ) - ( start . getTime ( ) ) ) ) + "ms" ) ) ; } System . out . println ( ( ( hits . length ( ) ) + "<seq2seq4repair_space>total<seq2seq4repair_space>matching<seq2seq4repair_space>documents" ) ) ; final int HITS_PER_PAGE = 10 ; for ( int start = 0 ; start < ( hits . length ( ) ) ; start += HITS_PER_PAGE ) { int end = Math . min ( hits . length ( ) , ( start + HITS_PER_PAGE ) ) ; for ( int i = start ; i < end ; i ++ ) { if ( raw ) { System . out . println ( ( ( ( "doc=" + ( hits . id ( i ) ) ) + "<seq2seq4repair_space>score=" ) + ( hits . score ( i ) ) ) ) ; continue ; } Document doc = hits . doc ( i ) ; String path = doc . get ( "path" ) ; if ( path != null ) { System . out . println ( ( ( ( i + 1 ) + ".<seq2seq4repair_space>" ) + path ) ) ; String title = doc . get ( "title" ) ; if ( title != null ) { System . out . println ( ( "<seq2seq4repair_space>Title:<seq2seq4repair_space>" + ( doc . get ( "title" ) ) ) ) ; } } else { System . out . println ( ( ( ( i + 1 ) + ".<seq2seq4repair_space>" ) + "No<seq2seq4repair_space>path<seq2seq4repair_space>for<seq2seq4repair_space>this<seq2seq4repair_space>document" ) ) ; } } if ( queries != null ) break ; if ( ( hits . length ( ) ) > end ) { System . out . print ( "more<seq2seq4repair_space>(y//n)<seq2seq4repair_space>?<seq2seq4repair_space>" ) ; line = in . readLine ( ) ; if ( ( ( line . length ( ) ) == 0 ) || ( ( line . charAt ( 0 ) ) == 'n' ) ) break ; } } } reader . close ( ) ; } }

Fix:
in = new BufferedReader ( new InputStreamReader ( System . in , "UTF-8" ) ) ;