Buggy code:
public class Sed { private static final String SQL_EXCEPTION_FILTERED_SUBSTITUTION = "SQL<seq2seq4repair_space>Exception:" ; public Sed ( ) { } public static void main ( String [ ] args ) throws Exception { } public void exec ( File srcFile , File dstFile , InputStream isSed , boolean isJCC , boolean isI18N , boolean isJDBC4 ) throws IOException { } public void execJCC ( InputStream is , File dstFile ) throws IOException { } private void doWork ( File srcFile , File dstFile , InputStream is , Vector deleteLines , Vector searchStrings , Vector subStrings , InputStream isSed ) throws IOException { } private void doWork ( File srcFile , File dstFile , InputStream is , Vector deleteLines , Vector searchStrings , Vector subStrings , InputStream isSed , boolean isI18N ) throws IOException { boolean lineDeleted = false ; PatternMatcher matcher ; Perl5Compiler pcompiler ; PatternMatcherInput input ; BufferedReader inFile ; PrintWriter outFile ; String result = "" ; String regex ; Vector delPatternVector = new Vector ( ) ; Vector subPatternVector = new Vector ( ) ; if ( isSed != null ) { Properties sedp = new Properties ( ) ; sedp . load ( isSed ) ; for ( Enumeration e = sedp . propertyNames ( ) ; e . hasMoreElements ( ) ; ) { String key = ( ( String ) ( e . nextElement ( ) ) ) ; if ( key . equals ( "substitute" ) ) { String value = sedp . getProperty ( key ) ; StringTokenizer st = new StringTokenizer ( value , "," ) ; String patternName = "" ; String patName = "" ; String subName = "" ; while ( st . hasMoreTokens ( ) ) { patternName = st . nextToken ( ) ; StringTokenizer st2 = new StringTokenizer ( patternName , ";" ) ; patName = st2 . nextToken ( ) ; subName = st2 . nextToken ( ) ; if ( ( ! ( patName . equals ( "" ) ) ) && ( ! ( subName . equals ( "" ) ) ) ) { searchStrings . addElement ( patName ) ; subStrings . addElement ( subName ) ; } } } else if ( key . equals ( "delete" ) ) { String value = sedp . getProperty ( key ) ; StringTokenizer st = new StringTokenizer ( value , "," ) ; String patternName = "" ; while ( st . hasMoreTokens ( ) ) { patternName = st . nextToken ( ) ; deleteLines . addElement ( patternName ) ; } } } } pcompiler = new Perl5Compiler ( ) ; matcher = new Perl5Matcher ( ) ; if ( is == null ) inFile = new BufferedReader ( new FileReader ( srcFile ) ) ; else <START_BUG> inFile = new BufferedReader ( new InputStreamReader ( is ) ) ; <END_BUG> outFile = new PrintWriter ( new BufferedWriter ( new FileWriter ( dstFile ) , 10000 ) , true ) ; for ( int i = 0 ; i < ( deleteLines . size ( ) ) ; i ++ ) { try { regex = ( ( String ) ( deleteLines . elementAt ( i ) ) ) ; Pattern pattern = pcompiler . compile ( regex ) ; if ( pattern == null ) System . out . println ( "pattern<seq2seq4repair_space>is<seq2seq4repair_space>null" ) ; delPatternVector . addElement ( pattern ) ; } catch ( MalformedPatternException e ) { System . out . println ( "Bad<seq2seq4repair_space>pattern." ) ; System . out . println ( e . getMessage ( ) ) ; } } for ( int i = 0 ; i < ( searchStrings . size ( ) ) ; i ++ ) { try { regex = ( ( String ) ( searchStrings . elementAt ( i ) ) ) ; Pattern pattern = pcompiler . compile ( regex ) ; if ( pattern == null ) System . out . println ( "pattern<seq2seq4repair_space>is<seq2seq4repair_space>null" ) ; subPatternVector . addElement ( pattern ) ; } catch ( MalformedPatternException e ) { System . out . println ( "Bad<seq2seq4repair_space>pattern." ) ; System . out . println ( e . getMessage ( ) ) ; } } String str ; int j ; int lineCount = 0 ; while ( ( str = inFile . readLine ( ) ) != null ) { lineCount ++ ; lineDeleted = false ; if ( ( str . length ( ) ) == 1 ) { if ( ( str . charAt ( 0 ) ) == ( ( char ) ( 0 ) ) ) { lineDeleted = true ; } } if ( isI18N ) { boolean hasNonAscii = false ; for ( int si = 0 ; si < ( str . length ( ) ) ; si ++ ) { char c = str . charAt ( si ) ; if ( ( c < ( ( char ) ( 32 ) ) ) || ( c >= ( ( char ) ( 127 ) ) ) ) { hasNonAscii = true ; break ; } } if ( hasNonAscii ) { StringBuffer sb = new StringBuffer ( ) ; for ( int si = 0 ; si < ( str . length ( ) ) ; si ++ ) { char c = str . charAt ( si ) ; if ( ( c < ( ( char ) ( 32 ) ) ) || ( c >= ( ( char ) ( 127 ) ) ) ) { sb . append ( '<seq2seq4repair_space>' ) ; sb . append ( "EnC:>" ) ; sb . append ( ( ( int ) ( str . charAt ( si ) ) ) ) ; sb . append ( "<<seq2seq4repair_space>" ) ; } else sb . append ( c ) ; } str = sb . toString ( ) ; } } if ( lineDeleted == false ) { for ( j = 0 ;

Fix:
inFile = new BufferedReader ( new InputStreamReader ( is , "UTF-8" ) ) ;