commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pratiyush (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CSV-148) CSVFormat.ignoreSurroundingSpaces is ignored when printing
Date Fri, 15 Apr 2016 22:55:25 GMT

     [ https://issues.apache.org/jira/browse/CSV-148?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Pratiyush updated CSV-148:
--------------------------
    Attachment: commons-csv_CSV-148.patch


Better way:
if(format.getIgnoreSurroundingSpaces()){
+                strValue = strValue.trim();
+            }else{
                 strValue = value.toString();
            }

Rather than comparing twice
======
 strValue = value.toString();
+            if(format.getIgnoreSurroundingSpaces()){
+                strValue = strValue.trim();
+            }

> CSVFormat.ignoreSurroundingSpaces is ignored when printing
> ----------------------------------------------------------
>
>                 Key: CSV-148
>                 URL: https://issues.apache.org/jira/browse/CSV-148
>             Project: Commons CSV
>          Issue Type: Bug
>          Components: Printer
>    Affects Versions: 1.1
>         Environment: JDK 1.7
>            Reporter: Piotr Ciruk
>            Priority: Minor
>             Fix For: Review
>
>         Attachments: commons-csv_CSV-148.patch, commons-csv_CSV-148.patch
>
>
> It seems that {{CSVFormat}}'s property {{ignoreSurroundingSpaces}} is not taken into
consideration while printing out values using {{CSVPrinter}}.
> Given:
> {code}
> System.out.println(
> 	CSVFormat.DEFAULT
> 			.withIgnoreSurroundingSpaces(true)
> 			.format("",
> 				" ",
> 				" Single space on the left",
> 				"Single space on the right ",
> 				" Single spaces on both sides ",
> 				"   Multiple spaces on the left",
> 				"Multiple spaces on the right    ",
> 				"  Multiple spaces on both sides     ")
> );
> {code}
> Actual result:
> {code}
> ""," "," Single space on the left","Single space on the right "," Single spaces on both
sides ","   Multiple spaces on the left","Multiple spaces on the right    ","  Multiple spaces
on both sides     "
> {code}
> Expected result:
> {code}
> "","","Single space on the left","Single space on the right","Single spaces on both sides","Multiple
spaces on the left","Multiple spaces on the right","Multiple spaces on both sides"
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message