Skip to content
Snippets Groups Projects
Commit de5c9e8d authored by Piotr Gawron's avatar Piotr Gawron
Browse files

error message is more informative when uploading sbml with invalid ids

parent af01620c
No related branches found
No related tags found
2 merge requests!412changes from 12.1.0~beta.1 into master,!392Resolve "upload of this sbml file crash"
Pipeline #6376 passed
......@@ -65,6 +65,9 @@ public abstract class SbmlElementParser<T extends org.sbml.jsbml.Symbol> extends
}
used.add(source.getElementId());
AbstractReferenceGlyph glyph = idGlyphPair.getRight();
if (glyph.getId() == null || glyph.getId().equals("")) {
throw new InvalidInputDataExecption("Glyph for Species " + idGlyphPair.getLeft() + " doesn't have id");
}
Element elementWithLayout = source.copy();
elementWithLayout.setElementId(glyph.getId());
elementWithLayout.setX(glyph.getBoundingBox().getPosition().getX());
......
......@@ -40,6 +40,11 @@ public class SbmlParserTest {
assertFalse(compartment.getClass().equals(Compartment.class));
}
@Test(expected = InvalidInputDataExecption.class)
public void testInvalidSpeciesId() throws FileNotFoundException, InvalidInputDataExecption {
parser.createModel(new ConverterParams().filename("testFiles/invalid_layout_alias_without_id.xml"));
}
@Test
public void testParseUnits() throws FileNotFoundException, InvalidInputDataExecption {
Model model = parser.createModel(
......
<?xml version="1.0" encoding="UTF-8"?>
<sbml xmlns="http://www.sbml.org/sbml/level3/version1/core" xmlns:layout="http://www.sbml.org/sbml/level3/version1/layout/version1" level="3" version="1" layout:required="false">
<model id="untitled" name="NEW DISEASE MAP">
<listOfUnitDefinitions>
<unitDefinition id="time" name="time"/>
<unitDefinition id="area" name="area"/>
<unitDefinition id="volume" name="volume"/>
<unitDefinition id="substance" name="substance"/>
<unitDefinition id="length" name="length"/>
</listOfUnitDefinitions>
<listOfSpecies>
<species sboTerm="SBO:0000252" id="species_6" name="F">
<notes>
<body xmlns="http://www.w3.org/1999/xhtml">
<p/>
</body>
</notes>
<annotation>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:vCard="http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:bqbiol="http://biomodels.net/biology-qualifiers/" xmlns:bqmodel="http://biomodels.net/model-qualifiers/">
<rdf:Description rdf:about="#"/>
</rdf:RDF>
</annotation>
</species>
</listOfSpecies>
<listOfReactions>
</listOfReactions>
<layout:listOfLayouts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:layout="http://www.sbml.org/sbml/level3/version1/layout/version1">
<layout:layout layout:id="predicted_layout">
<layout:dimensions layout:width="762.238734102226" layout:height="293.472408203789"/>
<layout:listOfSpeciesGlyphs>
<layout:speciesGlyph layout:species="species_6">
<layout:boundingBox>
<layout:position layout:x="170" layout:y="228.75"/>
<layout:dimensions layout:width="80" layout:height="40"/>
</layout:boundingBox>
</layout:speciesGlyph>
</layout:listOfSpeciesGlyphs>
<layout:listOfTextGlyphs>
</layout:listOfTextGlyphs>
</layout:layout>
</layout:listOfLayouts>
</model>
</sbml>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment