Issue
I am trying to get get the ModelDemo.java to work because I would like to work with the Java API. Unfortunately, I am running into errors...
I am using Eclipse IDE Version 2020-06 (4.16.0), openjdk 11.0.10 2021-01-19 and uppaal64-4.1.24 for linux. I have created a project which contains the the ModelDemo.java file. I have also added model.jar and uppaal.jar as external JARs to the Classpath of the project in eclipse.
Running the main in ModelDemo.java with the 'hardcoded' argument returns this log:
(L0, L0, v=0, x ? 0, y ? 0, z ? 0, x = y, x = z, y = z, )
Exp1: L0 ? L1, (L1, L0, v=1, x ? [0,10], y ? 0, z ? 0, x ? y, x ? z, y = z, )
Exp2: L0 ? L1, (L1, L1, v=1, x ? [0,10], y ? 0, z ? 0, x ? y, x ? z, y = z, )
Exp1: L1 ? L2, (L2, L1, v=2, x ? [5,10], y ? [0,5], z ? 5, x - y ? [5,10], x ? z, y - z ? -5, )
Exp2: L1 ? L2, (L2, L2, v=2, x ? [5,30], y ? [0,20], z ? 5, x - y ? [5,10], x ? z, y - z ? -5, )
Exp2: L2 ? L3, (L2, L3, v=3, x ? [15,30], y ? [10,20], z ? [0,10], x - y ? [5,10], x - z ? [15,30], y - z ? [10,20], )
Exp2: L3 ? L0, (L2, L0, v=4, x ? [15,30], y ? [10,20], z ? [0,10], x - y ? [5,10], x - z ? [15,30], y - z ? [10,20], )
Exp1: L2 ? L3, (L3, L0, v=3, x ? 15, y ? 10, z ? 0, x - y ? [5,10], x - z ? [15,30], y - z ? [10,20], )
Exp1: L3 ? Final, (Final, L0, v=5, x ? 15, y ? 10, z ? 0, x - y ? [5,10], x - z ? [15,30], y - z ? [10,20], )
deadlock
===== Simple check =====
Result: OK
===== SMC check =====
(401 runs) Pr(<> ...) in [0.424048,0.523972]
with confidence 0.95.
Result: OK: [0.424048,0.523972]
===== Custom check =====
Result: OK
===== Custom SMC =====
(393 runs) Pr(<> ...) in [0.375518,0.475494]
with confidence 0.95.
Result: OK: [0.375518,0.475494]
===== Custom Concrete Simulation =====
Result: OK
Plot "Simulations (1)" showing "value" over "time"
Trajectory v: (0.0,2.0) (30.1,2.0)
Trajectory x: (0.0,5.0) (30.1,35.1)
Trajectory y: (0.0,5.0) (30.1,35.1)
Error while getting memory info: 34Error while getting memory info: 34Error while getting memory info: 34
It seems to run mostly fine but encounters an error right at the end. (Error while getting memory info: 34)
Running the main in ModelDemo.java on a pre-existing file unfortunately always returns some xml-parsing error. I have tried this on files I have created myself using the Gui and on the examples that are delivered in the demo folder:
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,3]
Message: The markup declarations contained or pointed to by the document type declaration must be well-formed.
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:652)
at java.xml/com.sun.xml.internal.stream.XMLEventReaderImpl.nextEvent(XMLEventReaderImpl.java:83)
at com.uppaal.model.io2.XMLReader.next(XMLReader.java:98)
at com.uppaal.model.io2.XMLReader.begin(XMLReader.java:109)
at com.uppaal.model.io2.XMLReader.project(XMLReader.java:179)
at com.uppaal.model.io2.XMLReader.parse(XMLReader.java:85)
at com.uppaal.model.core2.PrototypeDocument.load(PrototypeDocument.java:235)
at app.ModelDemo.loadModel(ModelDemo.java:209)
at app.ModelDemo.main(ModelDemo.java:332)
java.io.IOException: ParseError at [row,col]:[1,3]
Message: The markup declarations contained or pointed to by the document type declaration must be well-formed.
at com.uppaal.model.core2.PrototypeDocument.load(PrototypeDocument.java:271)
at app.ModelDemo.loadModel(ModelDemo.java:209)
at app.ModelDemo.main(ModelDemo.java:332)
(javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,3] Message: The markup declarations contained or pointed to by the document type declaration must be well-formed.)
Any help would be highly appreciated. Thanks in advance!
Solution
Error while getting memory info: 34
this error seems from memory usage measurements, strange, but it should be harmless.
javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,3] Message: The markup declarations contained or pointed to by the document type declaration must be well-formed.
Relates to DTD definition at the very first two lines.
Perhaps a different Uppaal version was used to create the XML document.
The solution is to copy-over the first two lines from one of demo
example documents of the same Uppaal version.
This is not a guaranteed workaround (certain tags might be lost, or the parser may get stuck on particular tag it does not reqcognize), but it may just work.
Answered By - mariusm
Answer Checked By - Gilberto Lyons (JavaFixing Admin)