Skip to content

Generated ODS document without Table causes NPE #2465

@thadguidry

Description

@thadguidry

Describe the bug
An ODS document without a office:spreadsheet element causes an NPE

To Reproduce
Steps to reproduce the behavior:

  1. Download NoData_NoSpreadsheet.ods.zip
  2. Rename to NoData_NoSpreadsheet.ods
  3. Import the generated file NoData_NoSpreadsheet.ods (just rename attached ODS package file)
  4. OpenRefine recognizes as a valid ODF file (incorrectly) and attempts to parse as ODS format.
  5. See error

Current Results
Fails silently and presents the user with a blank preview pane and no indication of error.

The server console/log shows the following stack trace:

14:39:30.626 [                   refine] POST /command/core/importing-controller (3ms)
Mar 23, 2020 2:39:30 PM org.odftoolkit.odfdom.dom.OdfSchemaDocument getTables
SEVERE: null
java.lang.NullPointerException
        at org.odftoolkit.odfdom.dom.OdfSchemaDocument.fillTableList(OdfSchemaDocument.java:340)
        at org.odftoolkit.odfdom.dom.OdfSchemaDocument.getTables(OdfSchemaDocument.java:324)
        at org.odftoolkit.odfdom.doc.OdfDocument.getTableList(OdfDocument.java:692)
        at com.google.refine.importers.OdsImporter.parseOneFile(OdsImporter.java:142)
        at com.google.refine.importers.ImportingParserBase.parseOneFile(ImportingParserBase.java:118)
        at com.google.refine.importers.ImportingParserBase.parse(ImportingParserBase.java:89)
        at com.google.refine.importing.ImportingUtilities.previewParse(ImportingUtilities.java:961)
        at com.google.refine.importing.DefaultImportingController.doUpdateFormatAndOptions(DefaultImportingController.java:174)
        at com.google.refine.importing.DefaultImportingController.doPost(DefaultImportingController.java:93)
        at com.google.refine.commands.importing.ImportingControllerCommand.doPost(ImportingControllerCommand.java:68)
        at com.google.refine.RefineServlet.service(RefineServlet.java:190)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

Expected behavior
OpenRefine should show an error dialog saying that the file is not a valid ODS document and include a link to the online ODF validator - https://odfvalidator.org/.

Desktop:

  • OS: Windows 10
  • Browser Version: Firefox
  • JRE or JDK Version: JDK8

OpenRefine:

  • Version OpenRefine 3.3

Additional context
The provided generated ODS file is actually NOT VALID, and failed parsing with online hosted ODF Validator instance

Result for NoData_NoSpreadsheet.ods

The document is NOT conformant ODF1.2!
Details:
NoData_NoSpreadsheet.ods: Info: ODF version of root document: 1.2
NoData_NoSpreadsheet.ods/mimetype: Error: The file 'mimetype' shall not be compressed in the ODF package 'NoData_NoSpreadsheet.ods'!
NoData_NoSpreadsheet.ods/mimetype: Error: The file 'mimetype' is not the first file in the ODF package 'NoData_NoSpreadsheet.ods'!
internal:/schema/odf1.2/OpenDocument-v1.2-os-manifest-schema.rng: Info: parsed.
NoData_NoSpreadsheet.ods/META-INF/manifest.xml: Info: no errors, no warnings
NoData_NoSpreadsheet.ods/mimetype: Info: 2 errors, no warnings
NoData_NoSpreadsheet.ods: Info: Media Type: application/vnd.oasis.opendocument.spreadsheet
internal:/schema/odf1.2/OpenDocument-v1.2-os-schema.rng: Info: parsed.
NoData_NoSpreadsheet.ods/meta.xml: Info: Generator: LibreOffice/6.0.3.2$Windows_X86_64 LibreOffice_project/8f48d515416608e3a835360314dac7e47fd0b821
NoData_NoSpreadsheet.ods/meta.xml: Info: no errors, no warnings
NoData_NoSpreadsheet.ods/settings.xml: Info: no errors, no warnings
NoData_NoSpreadsheet.ods/styles.xml: Info: no errors, no warnings
NoData_NoSpreadsheet.ods/content.xml[23,16]: Error: uncompleted content model. expecting: <chart>,<database>,<drawing>,<image>,<presentation>,<spreadsheet>,<text>
</office:body> ----^ NoData_NoSpreadsheet.ods/content.xml: Info: 1 errors, no warnings
internal:/schema/odf1.2/OpenDocument-v1.2-os-dsig-schema.rng: Info: parsed.
NoData_NoSpreadsheet.ods: Info: 3 errors, no warnings

Metadata

Metadata

Assignees

Labels

Difficulty: IntermediateIdentifies moderately challenging issues that require some experience and familiarity with project.ODSImport/export from/to LibreOffice spreadsheetsPriority: LowIndicates less critical issues that can be dealt with at a later stageType: BugIssues related to software defects or unexpected behavior, which require resolution.importAbout importers in general - add a label for the data format if available

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions