commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1398365 - /commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java
Date Mon, 15 Oct 2012 16:27:25 GMT
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) {



Mime
View raw message