eclipse / jbom

Apache License 2.0
111 stars 5 forks source link

NullPointerException in case no components are found #10

Closed rolfhub closed 2 years ago

rolfhub commented 2 years ago

I get a NPE in case no components are found during analysis: 2022-10-05 13:59:30:713 TRACE --- [jbom] Analyzing file spsi085j-V235_29_0003.jar 2022-10-05 13:59:30:767 TRACE --- [jbom] Couldn't save SBOM to /home/rolf/workspace/javaserver/jbom/jbom-spsi085j-V235_29_0003.json java.lang.NullPointerException: Cannot invoke "java.util.List.size()" because the return value of "com.contrastsecurity.CycloneDXModel.getComponents()" is null at com.contrastsecurity.CycloneDXModel.save(CycloneDXModel.java:62) at com.contrastsecurity.Libraries.save(Libraries.java:51) at com.contrastsecurity.Jbom.doLocalFile(Jbom.java:198) at com.contrastsecurity.Jbom.doLocalFile(Jbom.java:169) at com.contrastsecurity.Jbom.run(Jbom.java:109) at picocli.CommandLine.executeUserObject(CommandLine.java:1939) at picocli.CommandLine.access$1300(CommandLine.java:145) at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2358) at picocli.CommandLine$RunLast.handle(CommandLine.java:2352) at picocli.CommandLine$RunLast.handle(CommandLine.java:2314) at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2179) at picocli.CommandLine$RunLast.execute(CommandLine.java:2316) at picocli.CommandLine.execute(CommandLine.java:2078) at com.contrastsecurity.Jbom.main(Jbom.java:73)

Version: JBom 1.2 Environment: openjdk version "17.0.4.1" 2022-08-12 on Ubuntu 20.04

planetlevel commented 2 years ago

Fixed - see 1.2.1 release. Thanks!!