sbmlteam / jsbml

JSBML is a community-driven project to create a free, open-source, pure Java™ library for reading, writing, and manipulating SBML files (the Systems Biology Markup Language) and data streams. It is an alternative to the mixed Java/native code-based interface provided in libSBML.

Home Page:https://sbml.org/software/jsbml/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exceptions thrown depending on the log level

BradleyScrim opened this issue · comments

Overview

Using the jsbml-core-1.5 in MaSyMoS we encountered a problem with this library. Here is our issue

If the log level is set to DEBUG or lower, Exceptions are thrown. This seems kind of weird. Like an anti-Heisenbug.
With log level INFO the parsing works just fine.

It would be great, if you'd fix this bug in a next release

Stacktrace

exception 1
2020-06-02 15:51:10,878 - [DEBUG] main org.sbml.jsbml.ASTNode:deriveUnit(ASTNode.java:2360) ASTNode: ASTNode.deriveUnit - before simplify - units = 
2020-06-02 15:51:10,880 - [DEBUG] main org.sbml.jsbml.ASTNode:deriveUnit(ASTNode.java:2361) ASTNode: ASTNode.deriveUnit - after simplify  - units = 
2020-06-02 15:51:10,883 - [DEBUG] main org.sbml.jsbml.ASTNode:addChild(ASTNode.java:1825) ASTNode:  adding child current node: 
ASTNode [type=TIMES, user object keys = [jsbml.allow.invalid.sbml]]  unit:unitDefinition []

Exception in thread "main" Undefined combination of Level 0 and Version 0 for element unitDefinition.
	at org.sbml.jsbml.AbstractSBase.<init>(AbstractSBase.java:282)
	at org.sbml.jsbml.AbstractNamedSBase.<init>(AbstractNamedSBase.java:80)
	at org.sbml.jsbml.UnitDefinition.<init>(UnitDefinition.java:550)
	at org.sbml.jsbml.util.compilers.ASTNodeValue.getUnits(ASTNodeValue.java:243)
	at org.sbml.jsbml.ASTNode.deriveUnit(ASTNode.java:2356)
	at org.sbml.jsbml.ASTNode.astNodeToTree(ASTNode.java:4601)
	at org.sbml.jsbml.ASTNode.addChild(ASTNode.java:1826)
	at org.sbml.jsbml.xml.parsers.MathMLStaxParser.processStartElement(MathMLStaxParser.java:568)
	at org.sbml.jsbml.xml.stax.SBMLReader.processStartElement(SBMLReader.java:1004)
	at org.sbml.jsbml.xml.stax.SBMLReader.readXMLFromXMLEventReader(SBMLReader.java:767)
	at org.sbml.jsbml.xml.stax.SBMLReader.readSBMLFromStream(SBMLReader.java:554)
	at org.sbml.jsbml.xml.stax.SBMLReader.readSBMLFromStream(SBMLReader.java:564)
	at org.sbml.jsbml.SBMLReader.readSBMLFromStream(SBMLReader.java:251)
	at de.unirostock.sems.masymos.extractor.SBML.SBMLExtractor.extractFromSBML(SBMLExtractor.java:191)
	at de.unirostock.sems.masymos.extractor.SBML.SBMLExtractor.extractStoreIndexSBML(SBMLExtractor.java:67)
	at de.unirostock.sems.masymos.main.MainExtractor.sbmlFileMode(MainExtractor.java:426)
	at de.unirostock.sems.masymos.main.MainExtractor.main(MainExtractor.java:138)
exception 2
2020-06-03 21:17:45,210 - [DEBUG] main org.sbml.jsbml.ASTNode:deriveUnit(ASTNode.java:2338) ASTNode: ASTNode.deriveUnit - before simplify - units = 
2020-06-03 21:17:45,210 - [DEBUG] main org.sbml.jsbml.ASTNode:deriveUnit(ASTNode.java:2339) ASTNode: ASTNode.deriveUnit - after simplify  - units = 
2020-06-03 21:17:45,210 - [DEBUG] main org.sbml.jsbml.ASTNode:addChild(ASTNode.java:1820) ASTNode:  adding child current node: 
ASTNode [type=TIMES, user object keys = [jsbml.allow.invalid.sbml]]  unit:unitDefinition []

Exception in thread "main" org.sbml.jsbml.SBMLException: Fractions must have one numerator and one denominator, here 0 elements are given.
	at org.sbml.jsbml.ASTNode.compile(ASTNode.java:1966)
	at org.sbml.jsbml.ASTNode.deriveUnit(ASTNode.java:2334)
	at org.sbml.jsbml.ASTNode.astNodeToTree(ASTNode.java:4577)
	at org.sbml.jsbml.ASTNode.addChild(ASTNode.java:1821)
	at org.sbml.jsbml.xml.parsers.MathMLStaxParser.processStartElement(MathMLStaxParser.java:564)
	at org.sbml.jsbml.xml.stax.SBMLReader.processStartElement(SBMLReader.java:981)
	at org.sbml.jsbml.xml.stax.SBMLReader.readXMLFromXMLEventReader(SBMLReader.java:744)
	at org.sbml.jsbml.xml.stax.SBMLReader.readSBMLFromStream(SBMLReader.java:542)
	at org.sbml.jsbml.xml.stax.SBMLReader.readSBMLFromStream(SBMLReader.java:552)
	at org.sbml.jsbml.SBMLReader.readSBMLFromStream(SBMLReader.java:251)
	at de.unirostock.sems.masymos.extractor.SBML.SBMLExtractor.extractFromSBML(SBMLExtractor.java:191)
	at de.unirostock.sems.masymos.extractor.SBML.SBMLExtractor.extractStoreIndexSBML(SBMLExtractor.java:67)
	at de.unirostock.sems.masymos.main.MainExtractor.sbmlFileMode(MainExtractor.java:426)
	at de.unirostock.sems.masymos.main.MainExtractor.main(MainExtractor.java:138)

ToDo

Yes, sorry about that, this issue is already fixed in 1.6-SNAPSHOT in maven (the master branch in github). The method astNodeToTree was not supposed to call any recursive methods on the ASTNode.

thanks for the reply!

is there already a release date for the stable 1.6 ?

Not at the moment, we have few other issues we would like to fix but if we can deal with them by the end of august, we could try to do a quick release after that. Failing that, I might be able to do a 1.5.1 maven release with just this fix in september.

thanks! that would be great! :)