spdx / tools

SPDX Tools
Apache License 2.0
126 stars 69 forks source link

Exception in thread "main" java.lang.NullPointerException #155

Closed vcmgc27 closed 6 years ago

vcmgc27 commented 6 years ago

Hello,

When trying to convert Spreadsheet to RDF getting the below error.

Exception in thread "main" java.lang.NullPointerException at org.spdx.spdxspreadsheet.SPDXSpreadsheet.readVersion(SPDXSpreadsheet.java:135) at org.spdx.spdxspreadsheet.SPDXSpreadsheet.(SPDXSpreadsheet.java:101) at org.spdx.tools.SpreadsheetToRDF.onlineFunction(SpreadsheetToRDF.java:140) at org.spdx.tools.SpreadsheetToRDF.main(SpreadsheetToRDF.java:97) at org.spdx.tools.Main.main(Main.java:41)

Used the below command: java -jar spdx-tools-2.1.7-jar-with-dependencies.jar SpreadsheetToRDF C:\test\Spreadsheet.xls C:\test.rdf

Help in resolving this.

Thanks, Vcmgc

goneall commented 6 years ago

@vcmgc27 From looking at the code, it looks like the spreadsheet does not have sheet names matching the expected output.

The error handling definitely needs to be improved as you should not be getting an exception.

Can you attach the spreadsheet causing the problem?

vcmgc27 commented 6 years ago

Hi, Am using version: 2.1.11 and new to this tool. Using the document and trying it. The spreadsheet which am trying to use is extracted from another tool (Protex). Where the sheet names are different.

Guess this is the issue.

I tried using *.rdf file and converted to spreadsheet. it worked.

Thanks, Vcmgc

goneall commented 6 years ago

Good to hear - I'll keep this issue to track improving the error handling for incorrect sheet names.

goneall commented 6 years ago

Looking at the code where the NPE occurred, it is reading from a sheet opened by name. There is no check to see if the name is valid and if null is returned. The code should be updated to check if null and return an error message that the sheet is invalid due to sheet [name] does not exist.

vcmgc27 commented 6 years ago

Hi,

Thanks a lot.

Vcmgc

goneall commented 6 years ago

Resolved in 2.1.12