commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: [csv] CSVPrinter ResultSet quoting
Date Sat, 01 Nov 2014 04:52:50 GMT
Hi Damjan,

I think the process should be: create a JIRA, optionally attach a patch (or
commit a fix, up to you) that includes a unit test that demonstrates that
there is in fact a bug to fix. The test should fail without the fix of
course.

Thank you,
Gary

On Sat, Nov 1, 2014 at 12:33 AM, Damjan Jovanovic <damjan@apache.org> wrote:

> Hi
>
> Is there some reason CSVPrinter.printRecords(final ResultSet
> resultSet) retrieves all fields from the ResultSet using
> ResultSet.getString(), which makes QuoteMode.NON_NUMERIC quote
> numbers?
>
> This seems to work a lot better:
>
> Index: src/main/java/org/apache/commons/csv/CSVPrinter.java
> ===================================================================
> --- src/main/java/org/apache/commons/csv/CSVPrinter.java    (revision
> 1635890)
> +++ src/main/java/org/apache/commons/csv/CSVPrinter.java    (working copy)
> @@ -512,7 +512,7 @@
>          }
>          while (resultSet.next()) {
>              for (int i = 1; i <= columnCount; i++) {
> -                print(resultSet.getString(i));
> +                print(resultSet.getObject(i));
>              }
>              println();
>          }
>
>
> Can I commit?
>
> Thank you
> Damjan
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message