cfsimplicity / spreadsheet-cfml

Standalone library for working with spreadsheets and CSV in CFML
MIT License
127 stars 36 forks source link

Lucee Null Support #277

Closed decisionpartners closed 2 years ago

decisionpartners commented 2 years ago

Thanks for making such a great library - so much faster than other options!

Just updated to the latest version and am running into an issue when null support is set to "complete" in Lucee:

Can't cast Null value to value of type [collection] value is null. The error occurred on line 30 in file C:[path]\date.cfc.

The code I'm using to generate the error is the "susi frumpo" example you provide.

Using complete null support is really helpful with some APIs we need, so I was wondering if there was a workaround you could suggest?

Thanks!

cfsimplicity commented 2 years ago

Hi. Which code example do you mean?

Was it working on the version you were previously using? If so which version was that?

Thanks.

decisionpartners commented 2 years ago

The code example is:

<cfscript>
spreadsheet = New spreadsheetLibrary.Spreadsheet();
data = QueryNew( "First,Last", "VarChar, VarChar", [ [ "Susi", "Sorglos" ], [ "Frumpo", "McNugget" ] ] );
workbook = spreadsheet.new();
spreadsheet.addRows( workbook, data );
spreadsheet.write( workbook, "c:/temp/data.xls" );
</cfscript>

The version we were using was 2.12.1. By the way, the server we're using for testing is running Lucee 5.3.8.206 / AdoptOpenJDK 11.0.11.

It looks like we may have found a workaround for our specific case since spreadsheet access is required for only one directory. Apparently Lucee (as of 5.3) allows null support to be enabled/disabled as a runtime setting. So when this.nullSupport is set to false in the application.cfc of the directory in which spreadsheets are required, the code works as expected… while full support is enabled everywhere else.

Thanks again for your help.

cfsimplicity commented 2 years ago

Thanks, I see the problem. The fix is straightforward and probably a better way of doing things, so available on the develop branch in a few moments...

cfsimplicity commented 2 years ago

The latest 3.2.2 version should run fine with full null support enabled.

decisionpartners commented 2 years ago

Thank you! Much appreciated.