commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1398278 - in /commons/proper/csv/trunk/src: main/java/org/apache/commons/csv/CSVPrinter.java test/java/org/apache/commons/csv/CSVPrinterTest.java
Date Mon, 15 Oct 2012 13:15:10 GMT
Author: ggregory
Date: Mon Oct 15 13:15:09 2012
New Revision: 1398278

URL: http://svn.apache.org/viewvc?rev=1398278&view=rev
Log:
The class implements Closeable.

Modified:
    commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVPrinter.java
    commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.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=1398278&r1=1398277&r2=1398278&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 13:15:09 2012
@@ -23,6 +23,7 @@ import static org.apache.commons.csv.Con
 import static org.apache.commons.csv.Constants.LF;
 import static org.apache.commons.csv.Constants.SP;
 
+import java.io.Closeable;
 import java.io.Flushable;
 import java.io.IOException;
 import java.sql.ResultSet;
@@ -33,7 +34,7 @@ import java.sql.SQLException;
  * 
  * @version $Id: $
  */
-public class CSVPrinter implements Flushable {
+public class CSVPrinter implements Flushable, Closeable {
 
     /** The place that the values get written. */
     private final Appendable out;
@@ -387,4 +388,10 @@ public class CSVPrinter implements Flush
             println();
         }
     }
+
+    public void close() throws IOException {
+        if (out instanceof Closeable) {
+            ((Closeable) out).close();
+        }
+    }
 }

Modified: commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java?rev=1398278&r1=1398277&r2=1398278&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java (original)
+++ commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java Mon
Oct 15 13:15:09 2012
@@ -77,6 +77,7 @@ public class CSVPrinterTest {
         }
 
         printer.flush();
+        printer.close();
         final String result = sw.toString();
         // System.out.println("### :" + printable(result));
 



Mime
View raw message