RD files with zero record cause error when imported

User 80c35730b2

08-12-2011 11:38:01

The following two line RD file is legal - it just doesn't have any records (i.e. it is a reasonable end condition)


$RDFILE 1
$DATM 12/08/2011 11:10:40


Testing with MarvinView works - it does not error and it displays no content as expected


However JChem for Excel crashes with the following message (it would be better just to report that the file has no records and disable the import button)


Exception: System.ArgumentNullException
Message: Buffer cannot be null.
Parameter name: buffer
StackTrace:    at System.IO.MemoryStream..ctor(Byte[] buffer, Boolean writable)
   at System.IO.MemoryStream..ctor(Byte[] buffer)
   at ChemAxon.JChemExcel.IKVM.IO.MolImporterStructureRecordEnumerator.CreateMolImporter()
   at ChemAxon.JChemExcel.IKVM.IO.MolImporterStructureRecordEnumerator.<GetMoleculeStructureRecords>d__c.†††
†††‡Š(Object )
   at ChemAxon.JChemExcel.IKVM.IO.MolImporterStructureRecordEnumerator.<GetMoleculeStructureRecords>d__c.MoveNext()
   at ChemAxon.JChemExcel.IKVM.IO.MolImporterStructureRecordEnumerator.<GetRecords>d__0.†††
†††‡œ‘(Object )
   at ChemAxon.JChemExcel.IKVM.IO.MolImporterStructureRecordEnumerator.<GetRecords>d__0.MoveNext()
   at ChemAxon.NET.Base.ExtensionMethods.IEnumerableExtensions.<GroupEveryShrinkLast>d__2c`1.MoveNext()
   at ChemAxon.JChemExcel.Base.ExcelMapper.AbstractExcelEnumerableBatchMapper.†††
††††–‡(Object )
   at ChemAxon.JChemExcel.Base.ExcelMapper.AbstractExcelEnumerableBatchMapper.MapRecordBatches()
   at ChemAxon.JChemExcel.Base.ExcelMapper.DrawingExcelMapper.†††
††††˜ˆ(Object )
   at ChemAxon.JChemExcel.Base.ExcelMapper.DrawingExcelMapper.Execute()
   at ChemAxon.JChemExcel.IKVM.IO.MolImporterResultMapper.†††
††††›–(Object )
   at ChemAxon.JChemExcel.IKVM.IO.MolImporterResultMapper.Execute()
   at ChemAxon.JChemExcel.Base.Controls.BackgroundWorkerPresenter.†††
††††‹(Object )
   at ChemAxon.JChemExcel.Base.Controls.BackgroundWorkerPresenter.backgroundWorker_DoWork(Object sender, DoWorkEventArgs e)
   at System.ComponentModel.BackgroundWorker.OnDoWork(DoWorkEventArgs e)
   at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)


 

ChemAxon bd13b5bd77

08-12-2011 11:44:52

Thank you for feedback, however Excel did not really crash, or did it?


We will fix this in the next releases.

User 80c35730b2

08-12-2011 12:02:52

Sorry - crash means a stack dump was produced - not that Excel ceased to function. I'll say "stack dump" in furture posts

ChemAxon bd13b5bd77

08-12-2011 12:32:32

Yeah, thanks generally crash and error stack is a mutual exclusion situation.


Obviously the crash is even worse, hard to reproduce and hard to fix, if we have stack tracethen it sounds better.