Buggy code:
public static String printableFieldNamesToString ( ) { } public static String printableFieldNamesToString ( SampleSaveConfiguration saveConfig ) { } private static final LinkedMap headerLabelMethods = new LinkedMap ( ) ; public static SampleSaveConfiguration getSampleSaveConfiguration ( String headerLine , String filename ) { } private static String [ ] splitHeader ( String headerLine , String delim ) { } private static boolean isVariableName ( final String label ) { } public static void saveCSVStats ( Vector data , FileWriter writer ) throws IOException { } public static void saveCSVStats ( Vector data , FileWriter writer , String [ ] headers ) throws IOException { } public static void saveCSVStats ( DefaultTableModel model , FileWriter writer ) throws IOException { } public static String resultToDelimitedString ( SampleEvent event ) { } public static String resultToDelimitedString ( SampleEvent event , final String delimiter ) { final class StringQuoter { final StringBuffer sb = new StringBuffer ( ) ; private final char [ ] specials ; private boolean addDelim ; public StringQuoter ( char delim ) { } private void addDelim ( ) { if ( addDelim ) { sb . append ( specials [ 0 ] ) ; } else { addDelim = true ; } } public void append ( String s ) { addDelim ( ) ; sb . append ( CSVSaveService . quoteDelimiters ( s , specials ) ) ; } public void append ( Object obj ) { append ( String . valueOf ( obj ) ) ; } public void append ( int i ) { addDelim ( ) ; sb . append ( i ) ; } public void append ( long l ) { addDelim ( ) ; sb . append ( l ) ; } public void append ( boolean b ) { addDelim ( ) ; sb . append ( b ) ; } public String toString ( ) { return sb . toString ( ) ; } } StringQuoter text = new StringQuoter ( delimiter . charAt ( 0 ) ) ; SampleResult sample = event . getResult ( ) ; SampleSaveConfiguration saveConfig = sample . getSaveConfig ( ) ; if ( saveConfig . saveTimestamp ( ) ) { if ( saveConfig . printMilliseconds ( ) ) { text . append ( sample . getTimeStamp ( ) ) ; } else if ( ( saveConfig . formatter ( ) ) != null ) { String stamp = saveConfig . formatter ( ) . format ( new Date ( sample . getTimeStamp ( ) ) ) ; text . append ( stamp ) ; } } if ( saveConfig . saveTime ( ) ) { text . append ( sample . getTime ( ) ) ; } if ( saveConfig . saveLabel ( ) ) { text . append ( sample . getSampleLabel ( ) ) ; } if ( saveConfig . saveCode ( ) ) { text . append ( sample . getResponseCode ( ) ) ; } if ( saveConfig . saveMessage ( ) ) { text . append ( sample . getResponseMessage ( ) ) ; } if ( saveConfig . saveThreadName ( ) ) { text . append ( sample . getThreadName ( ) ) ; } if ( saveConfig . saveDataType ( ) ) { text . append ( sample . getDataType ( ) ) ; } if ( saveConfig . saveSuccess ( ) ) { text . append ( sample . isSuccessful ( ) ) ; } if ( saveConfig . saveAssertionResultsFailureMessage ( ) ) { String message = null ; AssertionResult [ ] results = sample . getAssertionResults ( ) ; if ( results != null ) { for ( int i = 0 ; i < ( results . length ) ; i ++ ) { message = results [ i ] . getFailureMessage ( ) ; if ( message != null ) { break ; } } } if ( message != null ) { text . append ( message ) ; } else { text . append ( "" ) ; } } if ( saveConfig . saveBytes ( ) ) { text . append ( sample . getBytes ( ) ) ; } if ( saveConfig . saveThreadCounts ( ) ) { text . append ( sample . getGroupThreads ( ) ) ; text . append ( sample . getAllThreads ( ) ) ; } if ( saveConfig . saveUrl ( ) ) { text . append ( sample . getURL ( ) ) ; } if ( saveConfig . saveFileName ( ) ) { text . append ( sample . getResultFileName ( ) ) ; } if ( saveConfig . saveLatency ( ) ) { text . append ( sample . getLatency ( ) ) ; } if ( saveConfig . saveEncoding ( ) ) { <START_BUG> text . append ( sample . getDataEncoding ( ) ) ; <END_BUG> } if ( saveConfig . saveSampleCount ( ) ) { text . append ( sample . getSampleCount ( ) ) ; text . append ( sample . getErrorCount ( ) ) ; } if ( saveConfig . saveHostname ( ) ) { text . append ( event . getHostname ( ) ) ; } for ( int i = 0 ; i < ( SampleEvent . getVarCount ( ) ) ; i ++ ) { text . append ( event . getVarValue ( i ) ) ; } return text . toString ( ) ; } private static String quoteDelimiters ( String input , char [ ] specialChars ) { } private static final int INITIAL = 0 ; private static final int PLAIN = 1 ; private static final int QUOTED = 2 ; private static final int EMBEDDEDQUOTE = 3 ; public static final char QUOTING_CHAR = '"' ; public static String [ ] csvReadFile ( BufferedReader infile , char delim ) throws IOException { } private static boolean isDelimOrEOL ( char delim , int ch ) { } }

Fix:
text . append ( sample . getDataEncodingWithDefault ( ) ) ;