Buggy code:
abstract class CSVLoader extends ContentStreamLoader { public static final String SEPARATOR = "separator" ; public static final String FIELDNAMES = "fieldnames" ; public static final String HEADER = "header" ; public static final String SKIP = "skip" ; public static final String SKIPLINES = "skipLines" ; public static final String MAP = "map" ; public static final String TRIM = "trim" ; public static final String EMPTY = "keepEmpty" ; public static final String SPLIT = "split" ; public static final String ENCAPSULATOR = "encapsulator" ; public static final String ESCAPE = "escape" ; public static final String OVERWRITE = "overwrite" ; private static Pattern colonSplit = Pattern . compile ( ":" ) ; private static Pattern commaSplit = Pattern . compile ( "," ) ; final IndexSchema schema ; final SolrParams params ; final CSVStrategy strategy ; final UpdateRequestProcessor processor ; String [ ] fieldnames ; SchemaField [ ] fields ; CSVLoader . FieldAdder [ ] adders ; int skipLines ; final AddUpdateCommand templateAdd ; private class FieldAdder { void add ( SolrInputDocument doc , int line , int column , String val ) { } } private class FieldAdderEmpty extends CSVLoader . FieldAdder { void add ( SolrInputDocument doc , int line , int column , String val ) { } } private class FieldTrimmer extends CSVLoader . FieldAdder { private final CSVLoader . FieldAdder base ; FieldTrimmer ( CSVLoader . FieldAdder base ) { } void add ( SolrInputDocument doc , int line , int column , String val ) { } } private class FieldMapperSingle extends CSVLoader . FieldAdder { private final String from ; private final String to ; private final CSVLoader . FieldAdder base ; FieldMapperSingle ( String from , String to , CSVLoader . FieldAdder base ) { } void add ( SolrInputDocument doc , int line , int column , String val ) { } } private class FieldSplitter extends CSVLoader . FieldAdder { private final CSVStrategy strategy ; private final CSVLoader . FieldAdder base ; FieldSplitter ( CSVStrategy strategy , CSVLoader . FieldAdder base ) { } void add ( SolrInputDocument doc , int line , int column , String val ) { } } String errHeader = "CSVLoader:" ; CSVLoader ( SolrQueryRequest req , UpdateRequestProcessor processor ) { } void prepareFields ( ) { fields = new SchemaField [ fieldnames . length ] ; adders = new CSVLoader . FieldAdder [ fieldnames . length ] ; String skipStr = params . get ( CSVLoader . SKIP ) ; List < String > skipFields = ( skipStr == null ) ? null : StrUtils . splitSmart ( skipStr , ',' ) ; CSVLoader . FieldAdder adder = new CSVLoader . FieldAdder ( ) ; CSVLoader . FieldAdder adderKeepEmpty = new CSVLoader . FieldAdderEmpty ( ) ; for ( int i = 0 ; i < ( fields . length ) ; i ++ ) { String fname = fieldnames [ i ] ; if ( ( ( fname . length ( ) ) == 0 ) || ( ( skipFields != null ) && ( skipFields . contains ( fname ) ) ) ) continue ; fields [ i ] = schema . getField ( fname ) ; boolean keepEmpty = params . getFieldBool ( fname , CSVLoader . EMPTY , false ) ; adders [ i ] = ( keepEmpty ) ? adderKeepEmpty : adder ; String [ ] fmap = params . getFieldParams ( fname , CSVLoader . MAP ) ; if ( fmap != null ) { for ( String mapRule : fmap ) { String [ ] mapArgs = CSVLoader . colonSplit . split ( mapRule , ( - 1 ) ) ; if ( ( mapArgs . length ) != 2 ) throw new org . apache . solr . common . SolrException ( ErrorCode . BAD_REQUEST , ( ( "Map<seq2seq4repair_space>rules<seq2seq4repair_space>must<seq2seq4repair_space>be<seq2seq4repair_space>of<seq2seq4repair_space>the<seq2seq4repair_space>form<seq2seq4repair_space>'from:to'<seq2seq4repair_space>,got<seq2seq4repair_space>'" + mapRule ) + "'" ) ) ; adders [ i ] = new CSVLoader . FieldMapperSingle ( mapArgs [ 0 ] , mapArgs [ 1 ] , adders [ i ] ) ; } } if ( params . getFieldBool ( fname , CSVLoader . TRIM , false ) ) { adders [ i ] = new CSVLoader . FieldTrimmer ( adders [ i ] ) ; } if ( params . getFieldBool ( fname , CSVLoader . SPLIT , false ) ) { String sepStr = params . getFieldParam ( fname , CSVLoader . SEPARATOR ) ; char fsep = ( ( sepStr == null ) || ( ( sepStr . length ( ) ) == 0 ) ) ? ',' : sepStr . charAt ( 0 ) ; String encStr = params . getFieldParam ( fname , CSVLoader . ENCAPSULATOR ) ; char fenc = ( ( encStr == null ) || ( ( encStr . length ( ) ) == 0 ) ) ? ( ( char ) ( - 2 ) ) : encStr . charAt ( 0 ) ; String escStr = params . getFieldParam ( fname , CSVLoader . ESCAPE ) ; <START_BUG> char fesc = ( ( escStr == null ) || ( ( encStr . length ( ) ) == 0 ) ) ? CSVStrategy . ESCAPE_DISABLED : escStr . charAt ( 0 ) ; <END_BUG> CSVStrategy fstrat = new CSVStrategy ( fsep , fenc , CSVStrategy . COMMENTS_DISABLED , fesc , false , false , false , false ) ; adders [ i ] = new CSVLoader . FieldSplitter ( fstrat , adders [ i ] ) ; } } } private void input_err ( String msg , String [ ] line , int lineno ) { } public void load ( SolrQueryRequest req , SolrQueryResponse rsp , ContentStream stream ) throws IOException { } abstract void addDoc ( int line , String [ ] vals ) throws IOException { } void doAdd ( int line , String [ ] vals , SolrInputDocument doc , AddUpdateCommand template ) throws IOException { } }

Fix:
char fesc = ( ( escStr == null ) || ( ( escStr . length ( ) ) == 0 ) ) ? CSVStrategy . ESCAPE_DISABLED : escStr . charAt ( 0 ) ;