Opened 15 years ago

Closed 15 years ago

#1157 closed defect (fixed)

Annotation importer fails with NullPointerException in end()

Reported by: Jari Häkkinen Owned by: Nicklas Nordborg
Priority: major Milestone: BASE 2.8.4
Component: coreplugins Version: 2.8.3
Keywords: Cc:

Description

The number of columns is correct. After adding the new line in the last line the annotaions are imported.

Tested on our facility server running BASE 2.8.3

Change History (7)

comment:1 by Nicklas Nordborg, 15 years ago

Works on the test code even if I remove the last empty line from the test file. So, what is happening when it doesn't work? Error message and other information would be useful.

comment:2 by Nicklas Nordborg, 15 years ago

(In [4599]) References #1157: Removed last empty line to check if this breaks the importer.

comment:3 by Jari Häkkinen, 15 years ago

Resolution: invalid
Status: newclosed

After getting more details about this I realize that there was a 'Data footer' parameter given to the plug-in but the file did not have a data footer! So of course the plug-in complains it cannot find a footer!

Case closed.

The output from the failed job is

java.lang.NullPointerException
at net.sf.basedb.plugins.AnnotationFlatFileImporter.end(AnnotationFlatFileImporter.java:872)
at net.sf.basedb.plugins.AbstractFlatFileImporter.doImport(AbstractFlatFileImporter.java:653)
at net.sf.basedb.plugins.AbstractFlatFileImporter.run(AbstractFlatFileImporter.java:443)
at net.sf.basedb.core.PluginExecutionRequest.invoke(PluginExecutionRequest.java:108)
at net.sf.basedb.core.InternalJobQueue$JobRunner.run(InternalJobQueue.java:506)
at java.lang.Thread.run(Thread.java:619)

comment:4 by Nicklas Nordborg, 15 years ago

Resolution: invalid
Status: closedreopened
Summary: Annotation importer fails when last line in file has data but no new line characterAnnotation importer fails with NullPointerException

Hmmm... I can't see how a missing Data footer in the file can lead to this error. A NullPointerException is usually a sign of some kind of bug. It should at least be replaced with a better error message.

I check the code it seems like this error can only happens if the start of the data could not be found. But that usually results in an error message saying something like: The file .... can't be imported by this plug-in. So, it seems like there is a loophole where the plug-in thinks it has found some data but when the import starts there is actually no data and the end() method is called but beginData() was never been called. In this case it may be that the NullPointerException is actually masking the real error message.

It would be useful with some more information, for example the plug-in configuration that results in the NullPointerException (can be exported as an XML file) and an example file to use it with.

comment:5 by Nicklas Nordborg, 15 years ago

Milestone: BASE 2.8.4
Owner: changed from everyone to Nicklas Nordborg
Status: reopenednew
Summary: Annotation importer fails with NullPointerExceptionAnnotation importer fails with NullPointerException in end()

I think the NullPointerException is just masking the real error message. One way to reproduce the problem is to enter a column mapping for the 'Name' property that doesn't exist in the file. This is not detected in the configuration phase and results in the NullPointerException. If the end() method is fixed an understandable error message is displayed: Column 'foo' not found in column headers.

comment:6 by Nicklas Nordborg, 15 years ago

Status: newassigned

comment:7 by Nicklas Nordborg, 15 years ago

Resolution: fixed
Status: assignedclosed

(In [4601]) Fixes #1157: Annotation importer fails with NullPointerException in end()

Note: See TracTickets for help on using tickets.