tracker issue : CF-4152515

select a category, or use search below
(searches all categories and all time range)
Title:

[ANeff] Bug for: cfspreadsheet throws ArrayIndexOutOfBoundsException if quoted CSV value does not contain comma

| View in Tracker

Status/Resolution/Reason: Closed/Fixed/

Reporter/Name(from Bugbase): Aaron Neff / Aaron Neff (Aaron Neff)

Created: 05/13/2016

Components: Document Management, Office Integration

Versions: 10.0

Failure Type:

Found In Build/Fixed In Build: CF2016_Final /

Priority/Frequency: Normal / Few users will encounter

Locale/System: English / Win XP All

Vote Count: 0

Listed in the version 2016.0.03.300466 Issues Fixed doc
cfspreadsheet throws ArrayIndexOutOfBoundsException if quoted CSV value does not contain comma

Repro:

<cfscript>
  myCSV = 'header' & chr(13) & chr(10) & '"va,lue"';
  cfspreadsheet(action="write", filename=expandPath("./myXLS.xls"), name="myCSV", format="csv", overwrite=true);//works (good)

  myCSV = 'header' & chr(13) & chr(10) & '"va""l,u""e"';
  cfspreadsheet(action="write", filename=expandPath("./myXLS.xls"), name="myCSV", format="csv", overwrite=true);//works (good)

  myCSV = 'header' & chr(13) & chr(10) & '"value"';
  cfspreadsheet(action="write", filename=expandPath("./myXLS.xls"), name="myCSV", format="csv", overwrite=true);//throws java.lang.ArrayIndexOutOfBoundsException
</cfscript>

Actual result: java.lang.ArrayIndexOutOfBoundsException

Expected result: myXLS.xls created successfully

Complexity succeeds, but simplicity fails. Hmm..

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	4152515

External Customer Info:
External Company:  
External Customer Name: Aaron Neff
External Customer Email:

Attachments:

Comments:

Workaround: use cfhttp (cfhttp parses the CSV properly) <cfscript> myCSV = 'header' & chr(13) & chr(10) & '"value"'; fileWrite(expandPath("./myCSV.csv"), myCSV); cfhttp(url='http://' & CGI.HTTP_HOST & getDirectoryFromPath(CGI.SCRIPT_NAME) & 'myCSV.csv', name="resultQuery"); writeDump(resultQuery);//successfully displays query </cfscript> cfhttp also properly handles the other myCSV strings from this ticket's description. Of course, cfspreadsheet should be fixed :) Thanks!, -Aaron
Comment by External U.
2828 | May 13, 2016 01:31:02 AM GMT
Can't parse CSV using cfspreadsheet, due to CF-4152515. Can't parse CSV using cfhttp, due to CF-4152543. :/
Comment by External U.
2829 | May 13, 2016 02:09:08 AM GMT
Hi Piyush, I have fixed first issue in CL 299842, Please raise a separate bug for second issue you have mentioned below.
Comment by Mayur J.
2830 | August 08, 2016 03:37:35 AM GMT
For windows platform the line separator is "/n/r" and for Solaris or Linux it is "/n" .
Comment by Mayur J.
2831 | September 26, 2016 02:58:52 AM GMT
Hi Mayur (and Piyush), I'm confused. What do you mean by "Please raise a separate bug for second issue you have mentioned" in this comment: ----------- 08/08/2016 03:37:35 GMT Hi Piyush, I have fixed first issue in CL 299842, Please raise a separate bug for second issue you have mentioned below. Comment by Mayur Jain ----------- What is the second issue? If Piyush raised a separate bug, could someone please share the number? Thanks!, -Aaron
Comment by Aaron N.
2832 | April 02, 2017 12:27:13 AM GMT
Huh? What are those alphanumeric chars after my name, in my previous comment?: "Comment by Aaron Neff - 3D1D17B03C844EBF992001AC"
Comment by Aaron N.
2833 | April 02, 2017 12:28:45 AM GMT
@Aaron, the characters after your name must be referring to some internal id and can be ignored
Comment by Vamseekrishna N.
2834 | April 02, 2017 12:54:08 AM GMT