BrightSpots / rcv

Ranked Choice Voting Universal Tabulator
Mozilla Public License 2.0
72 stars 19 forks source link

Input CVR file name containing % fails tabulation: java.util.MissingFormatArgumentException: Format specifier '%2C' #564

Closed andyanderson closed 3 years ago

andyanderson commented 3 years ago

I’m working with output files from Qualtrics, which URL-encodes contest names (I assume to ensure cross-platform file name compatibility). An example is:

What+Are+Your+Favorite+Fruits+and+Vegetables%3F_April+13%2C+2021_23.28_Fruits.csv

The %3F is '?’ and %2C is ','.

I’ve converted this to ES&S input format and resaved as Excel. When I validate, all is well. But when I tabulate, I get the following error:

java.util.UnknownFormatConversionException: Conversion = 'F' Tabulation failed!

If I shorten the file name to just “April+13%2C+2021_23.28_Fruits.csv”, I get this error:

java.util.MissingFormatArgumentException: Format specifier '%2C' Tabulation failed!

If I shorten the file name to just “Fruits.csv”, tabulation succeeds.

Apparently the file is being read by a different routine for tabulation than for validation, and the former isn’t taking care to protect the file name from attempted string formatting.

Attaching sample input files.

What+Are+Your+Favorite+Fruits+and+Vegetables%3F_April+13%2C+2021_23.28_Fruits.zip

tarheel commented 3 years ago

Thanks for flagging. We actually got the same report just recently from another source. Closing this because it's a duplicate of #561.