You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2012/10/15 18:27:25 UTC
svn commit: r1398365 -
/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java
Author: sebb
Date: Mon Oct 15 16:27:25 2012
New Revision: 1398365
URL: http://svn.apache.org/viewvc?rev=1398365&view=rev
Log:
Explicit unboxing; associated Javadoc
Modified:
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java
Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java?rev=1398365&r1=1398364&r2=1398365&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java (original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java Mon Oct 15 16:27:25 2012
@@ -67,7 +67,7 @@ public class CSVPrinter implements Flush
// ======================================================
/**
- * Outputs a the line separator.
+ * Outputs the line separator.
*/
public void println() throws IOException {
out.append(format.getLineSeparator());
@@ -130,7 +130,7 @@ public class CSVPrinter implements Flush
if (!newLine) {
println();
}
- out.append(format.getCommentStart());
+ out.append(format.getCommentStart().charValue());
out.append(SP);
for (int i = 0; i < comment.length(); i++) {
final char c = comment.charAt(i);
@@ -142,7 +142,7 @@ public class CSVPrinter implements Flush
//$FALL-THROUGH$ break intentionally excluded.
case LF:
println();
- out.append(format.getCommentStart());
+ out.append(format.getCommentStart().charValue());
out.append(SP);
break;
default:
@@ -172,6 +172,9 @@ public class CSVPrinter implements Flush
}
}
+ /*
+ * Note: must only be called if escaping is enabled, otherwise will generate NPE
+ */
void printAndEscape(final CharSequence value, final int offset, final int len) throws IOException {
int start = offset;
int pos = offset;
@@ -180,7 +183,7 @@ public class CSVPrinter implements Flush
printDelimiter();
final char delim = format.getDelimiter();
- final char escape = format.getEscape();
+ final char escape = format.getEscape().charValue();
while (pos < end) {
char c = value.charAt(pos);
@@ -210,6 +213,9 @@ public class CSVPrinter implements Flush
}
}
+ /*
+ * Note: must only be called if quoting is enabled, otherwise will generate NPE
+ */
void printAndQuote(Object object, final CharSequence value, final int offset, final int len) throws IOException {
final boolean first = newLine; // is this the first value on this line?
boolean quote = false;
@@ -220,7 +226,7 @@ public class CSVPrinter implements Flush
printDelimiter();
final char delimChar = format.getDelimiter();
- final char quoteChar = format.getQuoteChar();
+ final char quoteChar = format.getQuoteChar().charValue();
Quote quotePolicy = format.getQuotePolicy();
if (quotePolicy == null) {
Re: svn commit: r1398365 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java
Posted by Emmanuel Bourg <eb...@apache.org>.
Hi,
I was about to remove the explicit unboxing when I noticed this was
actually done on purpose. Why did you add this Sebastian? It pops up as
warnings in my IDE.
Emmanuel Bourg
Le 15/10/2012 18:27, sebb@apache.org a écrit :
> Author: sebb
> Date: Mon Oct 15 16:27:25 2012
> New Revision: 1398365
>
> URL: http://svn.apache.org/viewvc?rev=1398365&view=rev
> Log:
> Explicit unboxing; associated Javadoc
>
> Modified:
> commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java
>
> Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java
> URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java?rev=1398365&r1=1398364&r2=1398365&view=diff
> ==============================================================================
> --- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java (original)
> +++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java Mon Oct 15 16:27:25 2012
> @@ -67,7 +67,7 @@ public class CSVPrinter implements Flush
> // ======================================================
>
> /**
> - * Outputs a the line separator.
> + * Outputs the line separator.
> */
> public void println() throws IOException {
> out.append(format.getLineSeparator());
> @@ -130,7 +130,7 @@ public class CSVPrinter implements Flush
> if (!newLine) {
> println();
> }
> - out.append(format.getCommentStart());
> + out.append(format.getCommentStart().charValue());
> out.append(SP);
> for (int i = 0; i < comment.length(); i++) {
> final char c = comment.charAt(i);
> @@ -142,7 +142,7 @@ public class CSVPrinter implements Flush
> //$FALL-THROUGH$ break intentionally excluded.
> case LF:
> println();
> - out.append(format.getCommentStart());
> + out.append(format.getCommentStart().charValue());
> out.append(SP);
> break;
> default:
> @@ -172,6 +172,9 @@ public class CSVPrinter implements Flush
> }
> }
>
> + /*
> + * Note: must only be called if escaping is enabled, otherwise will generate NPE
> + */
> void printAndEscape(final CharSequence value, final int offset, final int len) throws IOException {
> int start = offset;
> int pos = offset;
> @@ -180,7 +183,7 @@ public class CSVPrinter implements Flush
> printDelimiter();
>
> final char delim = format.getDelimiter();
> - final char escape = format.getEscape();
> + final char escape = format.getEscape().charValue();
>
> while (pos < end) {
> char c = value.charAt(pos);
> @@ -210,6 +213,9 @@ public class CSVPrinter implements Flush
> }
> }
>
> + /*
> + * Note: must only be called if quoting is enabled, otherwise will generate NPE
> + */
> void printAndQuote(Object object, final CharSequence value, final int offset, final int len) throws IOException {
> final boolean first = newLine; // is this the first value on this line?
> boolean quote = false;
> @@ -220,7 +226,7 @@ public class CSVPrinter implements Flush
> printDelimiter();
>
> final char delimChar = format.getDelimiter();
> - final char quoteChar = format.getQuoteChar();
> + final char quoteChar = format.getQuoteChar().charValue();
>
> Quote quotePolicy = format.getQuotePolicy();
> if (quotePolicy == null) {
>
>