Version: 19.0.0-alpha-20
Build #: 54548
Build Date: 2017-May-31 10:02:46 AM
getAsExcel2003 gives Null Pointer Exception
1. With the latest changes for ADS #
15284 the below script to getAsExcel2003 gives Null Pointer Exception
2. Broken in build 19.0.0-alpha-20, Build #: 54548 and Build Date: 2017-May-31 10:02:46 AM
3. Works fine in Version: 19.0.0-alpha-19, Build #: 54539 and Build Date: 2017-May-30 03:47:16 PM
4. Works fine in ADS v18 latest build as well.
The default Spreadsheet Format under File > General is Excel 2007
The script is under our Data/AquaScripts/AQDataSet with name getAsExcel2003.xjs. Also attached here
AquaScript
==========
var dataSet = generateDataSet();
var bytes = dataSet.getAsExcel2003();
printByteArray(bytes);
var settings = aqua.data.newDataSetSettings();
var chart = aqua.chart.newChart();
bytes = dataSet.getAsExcel2003(settings, chart);
printByteArray(bytes);
//------------------------------------------------------------------------------
function generateDataSet(){
var ds = aqua.data.newDataSet(["shipcountry","freight","id"]);
ds.addRowWithValues(aqua.random.nextCountry(), "10", "100001");
ds.addRowWithValues(aqua.random.nextCountry(), "100", "100002");
ds.addRowWithValues(aqua.random.nextCountry(), "1000", "100003");
ds.addRowWithValues(aqua.random.nextCountry(), "10000", "100004");
return ds;
}
function printByteArray(bytes){
aqua.console.println("Printing Data Set as an array:");
for (var i=0; i<bytes.length; i++){
aqua.console.print("[" + bytes[i] + "]");
if ( (i % 50) == 49){
aqua.console.println("");
}
}
}
Added null check for CoreDataSetSettings. Same fix as ADS#15289.