Buggy code:
public class CSVFormat implements Serializable { private static final long serialVersionUID = 1L ; private final char delimiter ; private final Character quoteChar ; private final Quote quotePolicy ; private final Character commentStart ; private final Character escape ; private final boolean ignoreSurroundingSpaces ; private final boolean ignoreEmptyLines ; private final String lineSeparator ; private final String [ ] header ; static final CSVFormat PRISTINE = new CSVFormat ( Constants . COMMA , null , null , null , null , false , false , null , null ) ; public static final CSVFormat DEFAULT = CSVFormat . PRISTINE . withDelimiter ( Constants . COMMA ) . withQuoteChar ( Constants . DOUBLE_QUOTE ) . withIgnoreEmptyLines ( true ) . withLineSeparator ( Constants . CRLF ) ; public static final CSVFormat RFC4180 = CSVFormat . PRISTINE . withDelimiter ( Constants . COMMA ) . withQuoteChar ( Constants . DOUBLE_QUOTE ) . withLineSeparator ( Constants . CRLF ) ; public static final CSVFormat EXCEL = CSVFormat . PRISTINE . withDelimiter ( Constants . COMMA ) . withQuoteChar ( Constants . DOUBLE_QUOTE ) . withLineSeparator ( Constants . CRLF ) ; public static final CSVFormat TDF = CSVFormat . PRISTINE . withDelimiter ( Constants . TAB ) . withQuoteChar ( Constants . DOUBLE_QUOTE ) . withIgnoreSurroundingSpaces ( true ) . withIgnoreEmptyLines ( true ) . withLineSeparator ( Constants . CRLF ) ; public static final CSVFormat MYSQL = CSVFormat . PRISTINE . withDelimiter ( Constants . TAB ) . withEscape ( Constants . ESCAPE ) . withLineSeparator ( Constants . LF ) ; public CSVFormat ( final char delimiter , final Character quoteChar , final Quote quotePolicy , final Character commentStart , final Character escape , final boolean ignoreSurroundingSpaces , final boolean ignoreEmptyLines , final String lineSeparator , final String [ ] header ) { } private static boolean isLineBreak ( final Character c ) { } void validate ( ) throws IllegalStateException { } public char getDelimiter ( ) { } public CSVFormat withDelimiter ( final char delimiter ) { } public CSVFormat withDelimiter ( final Character delimiter ) { } public Character getQuoteChar ( ) { } public CSVFormat withQuoteChar ( final char quoteChar ) { } public CSVFormat withQuoteChar ( final Character quoteChar ) { } public boolean isQuoting ( ) { } public Character getCommentStart ( ) { } public CSVFormat withCommentStart ( final char commentStart ) { } public CSVFormat withCommentStart ( final Character commentStart ) { } public boolean isCommentingEnabled ( ) { } public Character getEscape ( ) { } public CSVFormat withEscape ( final char escape ) { } public CSVFormat withEscape ( final Character escape ) { } public boolean isEscaping ( ) { } public boolean getIgnoreSurroundingSpaces ( ) { } public CSVFormat withIgnoreSurroundingSpaces ( final boolean ignoreSurroundingSpaces ) { } public boolean getIgnoreEmptyLines ( ) { } public CSVFormat withIgnoreEmptyLines ( final boolean ignoreEmptyLines ) { } public String getLineSeparator ( ) { } public CSVFormat withLineSeparator ( final char lineSeparator ) { } public CSVFormat withLineSeparator ( final String lineSeparator ) { } public CSVFormat withQuotePolicy ( final Quote quotePolicy ) { } String [ ] getHeader ( ) { } public CSVFormat withHeader ( final String ... header ) { } public Iterable < CSVRecord > parse ( final Reader in ) throws IOException { } public String format ( final Object ... values ) { final StringWriter out = new StringWriter ( ) ; try { <START_BUG> new CSVPrinter ( out , this ) . println ( values ) ; <END_BUG> return out . toString ( ) . trim ( ) ; } catch ( final IOException e ) { throw new IllegalStateException ( e ) ; } } @ Override public String toString ( ) { } public Quote getQuotePolicy ( ) { } }

Fix:
new CSVPrinter ( out , this ) . printRecord ( values ) ;