SynBioDex / libSBOLj

Java Library for Synthetic Biology Open Language (SBOL)
Apache License 2.0
37 stars 24 forks source link

Some potential NPE bugs #601

Closed JulyChen728 closed 4 years ago

JulyChen728 commented 4 years ago

Hi all, Our bug scanner has reported some NPE bugs.

1.The first bug is caused by the return null in function getDescendantsOf() . A possible call chain is getDescendantsOf() => EDAMOntology.java#L311 . A NullPointerException may take place at EDAMOntology.java#L313 , when the return value of method getDescendantsOf() invokes its iterator method.

Several similar statements are at SequenceOntology.java#L329 , SequenceOntology.java#L296 , SystemsBiologyOntology.java#L331 and SystemsBiologyOntology.java#L348 .

2.The second bug is caused by the return null in function getId() . A possible call chain is SystemsBiologyOntology.java#L218 =>SystemsBiologyOntology.java#L229 . And a NPE may take place when the parameter stanzaId invokes its method trim() since it may be null .

Thanks.

cjmyers commented 4 years ago

Thanks. All good catches. What is the name of your bug scanner?

cjmyers commented 4 years ago

Fixed by PR #602