Skip to content

Commit 5f58cec

Browse files
committed
fix: sonarcloud code smell fix 6
1 parent bab5857 commit 5f58cec

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/main/java/org/apache/commons/csv/CSVFormat.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2333,7 +2333,7 @@ private void printWithQuotes(final Object object, final CharSequence charSeq, fi
23332333
// the need for encapsulation.
23342334
while (pos < len) {
23352335
final char c = charSeq.charAt(pos);
2336-
if (c == quoteChar || c == escapeChar) {
2336+
if (isQuoteCharOrEscapeChar(c, quoteChar, escapeChar)) {
23372337
// write out the chunk up until this point
23382338
out.append(charSeq, start, pos);
23392339
out.append(escapeChar); // now output the escape
@@ -2351,6 +2351,11 @@ private static boolean isLFCRQuoteCharOrEscapeChar(char c, char quoteChar, char
23512351
return c == LF || c == CR || c == quoteChar || c == escapeChar;
23522352
}
23532353

2354+
private static boolean isQuoteCharOrEscapeChar(char c, char quoteChar, char escapeChar) {
2355+
return c == quoteChar || c == escapeChar;
2356+
2357+
}
2358+
23542359
/**
23552360
* Always use quotes unless QuoteMode is NONE, so we do not have to look ahead.
23562361
*

0 commit comments

Comments
 (0)