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

EmptyStackException

piotr-gawron opened this issue · comments

When parsing one example from multi package specification (http://co.mbine.org/specifications/sbml.level-3.version-1.multi.version-1.release-1.pdf) I got java.util.EmptyStackException

java.util.EmptyStackException
	at java.util.Stack.peek(Stack.java:102)
	at org.sbml.jsbml.xml.stax.SBMLReader.readXMLFromXMLEventReader(SBMLReader.java:802)
	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 org.sbml.jsbml.SBMLReader.read(SBMLReader.java:128)

I narrowed down the problem to a small SBML file:

<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core"
	level="3" version="1"
	xmlns:multi="http://www.sbml.org/sbml/level3/version1/multi/version1"
	multi:required="true">
	<model name="bionetgen_example_egfr_simple">
		<multi:listOfSpeciesTypes>
			<multi:bindingSiteSpeciesType
				multi:id="st_EGF_bs_R" />
			<multi:speciesType multi:id="st_EGF">
				<multi:listOfSpeciesTypeInstances>
					<multi:component multi:id="R"
						multi:speciesType="st_EGF_bs_R" />
				</multi:listOfSpeciesTypeInstances>
			</multi:speciesType>
		</multi:listOfSpeciesTypes>
	</model>
</sbml>

The whole file obtained from the specification is in the attachment (bionetgen.xml.zip).

Thanks for the report, I will have a look at it.

The problem is the "component" element. It is an error, may be the example was generated with on old version of libsbml or other software. If you look at the first example, the listOfSpeciesTypeInstances contain only some "speciesTypeInstance" element. You can check as well the specs, figure 3 at the beginning of section 3.8.

I will try to make jsbml report this properly instead of throwing an exception.

This should be fixed now.

@piotr-gawron did you reported the problem to the sbml-multi specs tracker ? I found other mistakes in the specs example, the listOfInitialAssignments has a spelling mistake, the math namespace is not correctly written in the initialAssignment (the XML attribute is 'xmls' instead of 'xmlns'), the attribute identifyingParent on speciesTypeComponentIndex is missing the namespace declaration.

@niko-rodrigue
No I didn't report it there. For me the specification was really hard to digest and gave up at some point. But I assumed it's correct...

I will open a tracker item for them so that they can fix this.

Can you share it with me? Privately or put it here

Here is the link: https://sourceforge.net/p/sbml/sbml-specifications/359/. Just realized that I forgot to mention you..