Skip to content

Commit 3a90cfe

Browse files
committed
Explicit unboxing; associated Javadoc
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1398365 13f79535-47bb-0310-9956-ffa450edef68
1 parent 33c004f commit 3a90cfe

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public CSVPrinter(final Appendable out, final CSVFormat format) {
6767
// ======================================================
6868

6969
/**
70-
* Outputs a the line separator.
70+
* Outputs the line separator.
7171
*/
7272
public void println() throws IOException {
7373
out.append(format.getLineSeparator());
@@ -130,7 +130,7 @@ public void printComment(final String comment) throws IOException {
130130
if (!newLine) {
131131
println();
132132
}
133-
out.append(format.getCommentStart());
133+
out.append(format.getCommentStart().charValue());
134134
out.append(SP);
135135
for (int i = 0; i < comment.length(); i++) {
136136
final char c = comment.charAt(i);
@@ -142,7 +142,7 @@ public void printComment(final String comment) throws IOException {
142142
//$FALL-THROUGH$ break intentionally excluded.
143143
case LF:
144144
println();
145-
out.append(format.getCommentStart());
145+
out.append(format.getCommentStart().charValue());
146146
out.append(SP);
147147
break;
148148
default:
@@ -172,6 +172,9 @@ void printDelimiter() throws IOException {
172172
}
173173
}
174174

175+
/*
176+
* Note: must only be called if escaping is enabled, otherwise will generate NPE
177+
*/
175178
void printAndEscape(final CharSequence value, final int offset, final int len) throws IOException {
176179
int start = offset;
177180
int pos = offset;
@@ -180,7 +183,7 @@ void printAndEscape(final CharSequence value, final int offset, final int len) t
180183
printDelimiter();
181184

182185
final char delim = format.getDelimiter();
183-
final char escape = format.getEscape();
186+
final char escape = format.getEscape().charValue();
184187

185188
while (pos < end) {
186189
char c = value.charAt(pos);
@@ -210,6 +213,9 @@ void printAndEscape(final CharSequence value, final int offset, final int len) t
210213
}
211214
}
212215

216+
/*
217+
* Note: must only be called if quoting is enabled, otherwise will generate NPE
218+
*/
213219
void printAndQuote(Object object, final CharSequence value, final int offset, final int len) throws IOException {
214220
final boolean first = newLine; // is this the first value on this line?
215221
boolean quote = false;
@@ -220,7 +226,7 @@ void printAndQuote(Object object, final CharSequence value, final int offset, fi
220226
printDelimiter();
221227

222228
final char delimChar = format.getDelimiter();
223-
final char quoteChar = format.getQuoteChar();
229+
final char quoteChar = format.getQuoteChar().charValue();
224230

225231
Quote quotePolicy = format.getQuotePolicy();
226232
if (quotePolicy == null) {

0 commit comments

Comments
 (0)