#2310 closed defect (fixed)

NullPointerException when trying to remove annotation values and using an Excel sheet with empty cells

Reported by: Nicklas Nordborg Owned by: everyone
Priority: minor Milestone: BASE 3.19.10
Component: coreplugins Version:
Keywords: Cc:

Description

There seems to be a problem with using Excel sheets with empty cells with the annotation importer. Normally this would delete existing annotations but it seems like it causes a NullPointerException.

net.sf.basedb.core.BaseException: Cannot invoke "java.lang.Number.doubleValue()" because "num" is null on line 2 in file 'callable-bases-fix-int2long.xlsx': 13761132    35434292
  at net.sf.basedb.plugins.AbstractFlatFileImporter.doImport(AbstractFlatFileImporter.java:735)
  at net.sf.basedb.plugins.AnnotationFlatFileImporter.doImport(AnnotationFlatFileImporter.java:659)
  at net.sf.basedb.plugins.AbstractFlatFileImporter.run(AbstractFlatFileImporter.java:468)
  at net.sf.basedb.core.PluginExecutionRequest.invoke(PluginExecutionRequest.java:117)
  at net.sf.basedb.core.InternalJobQueue$JobRunner.run(InternalJobQueue.java:574)
  at java.base/java.lang.Thread.run(Thread.java:1623)
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Number.doubleValue()" because "num" is null
  at net.sf.basedb.core.Type$4.convertNumber(Type.java:217)
  at net.sf.basedb.core.Type.parseString(Type.java:732)
  at net.sf.basedb.util.excel.XlsxToCsvUtil$SheetInfo.getCellValueAsNumber(XlsxToCsvUtil.java:565)
  at net.sf.basedb.util.parser.FlatFileParser$ExcelData.getDouble(FlatFileParser.java:2158)
  at net.sf.basedb.util.parser.FlatFileParser$ExcelData.getInt(FlatFileParser.java:2136)
  at net.sf.basedb.util.parser.ColumnMapper.getInt(ColumnMapper.java:114)
  at net.sf.basedb.util.parser.Mapper.getByType(Mapper.java:123)
  at net.sf.basedb.plugins.AnnotationFlatFileImporter.handleData(AnnotationFlatFileImporter.java:872)
  at net.sf.basedb.plugins.AbstractFlatFileImporter.doImport(AbstractFlatFileImporter.java:700)
  ... 5 more

A workaround is to save the Excel sheet as a tab-separated text file.

Change History (2)

comment:1 by Nicklas Nordborg, 10 months ago

Component: webcoreplugins
Milestone: BASE 3.19.10
Priority: majorminor

comment:2 by Nicklas Nordborg, 10 months ago

Resolution: fixed
Status: newclosed

In 8168:

Fixes #2310: NullPointerException when trying to remove annotation values and using an Excel sheet with empty cells

Note: See TracTickets for help on using tickets.