Tcases get java.lang.RuntimeException on non-Oracle jvm

21 views
Skip to first unread message

Tianyu ZUO

unread,
Feb 18, 2016, 11:42:31 AM2/18/16
to Tcases Forum
HI there,


When I am using tcases with another JVM (non-Oracle), it will throw runtime exception and stop working. This issue will happen on all version of tcases with all 1.7 and higher version of this non-Oracle jvm. The Exception is like this:

---------------------------------------------------------------------------------------------------------------------------------------------
11:06:15.792 [main] INFO  org.cornutum.tcases.Tcases - Tcases 1.5.3.1 (2016-01-30)
11:06:15.808 [main] INFO  org.cornutum.tcases.Tcases - Reading system input definition=C:\Users\T\Tcases153src\examples\find-Input.xml
java.lang.RuntimeException: Can't read input definition file=C:\Users\T\Tcases153src\examples\find-Input.xml
    at org.cornutum.tcases.Tcases.run(Tcases.java:958)
    at org.cornutum.tcases.Tcases.main(Tcases.java:896)
Caused by: java.lang.RuntimeException: Error in document at line=1
    at org.cornutum.tcases.io.SystemInputDocReader.getSystemInputDef(SystemInputDocReader.java:1251)
    at org.cornutum.tcases.Tcases.run(Tcases.java:954)
    ... 1 more
Caused by: org.xml.sax.SAXParseException: Attribute= is not allowed for System elements
    at org.cornutum.tcases.io.SystemInputDocReader$ElementHandler.validateAttributes(SystemInputDocReader.java:132)
    at org.cornutum.tcases.io.SystemInputDocReader.startElement(SystemInputDocReader.java:1336)
    at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
    at org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElementHook(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl.parse(Unknown Source)
    at javax.xml.parsers.SAXParser.parse(Unknown Source)
    at org.cornutum.tcases.io.SystemInputDocReader.getSystemInputDef(SystemInputDocReader.java:1246)
    ... 2 more

-----------------------------------------------------------------------------------------------------------------------------------------------------

This issue is not caused by incorrect path as it can work well on Oracle JVM without changing any args or command lines.
I did a brief investigation into this problem, found that this problem is caused by function Attributes.getLocalName(int index) of org.xml.sax.Attributes.
In my non-Oracle jvm, this function cannot return a valid name, but the Oracle jvm can return a valid name (string). When I change it to Attributes.getQName(int index), tcases can pass this part can continue working.
According to the documentation[2], getLocalName() is supposed to returns "The local name, or the empty string if Namespace processing is not being performed, or null if the index is out of range." and Namespace processing is off by default [1]. It needs to be enabled (SAXParserFactory.setNamespaceAware(true)).

Could tcases change the function Attributes.getLocalName(int index) to Attributes.getQName(int index)? or enable SAXParserFactory.setNamespaceAware(true)?

Best regards

[1] http://w3.hursley.ibm.com/java/docs/java7/api/org/xml/sax/Attributes.html#getLocalName%28int%29
[2] http://w3.hursley.ibm.com/java/docs/java7/api/javax/xml/parsers/SAXParserFactory.html#setNamespaceAware%28boolean%29

Kerry Kimbrough

unread,
Feb 18, 2016, 8:23:55 PM2/18/16
to Tcases Forum
Tianyu,

Thanks for reporting this problem and giving such a helpful explanation. I've just completed a new release=1.5.4 that includes the fix you suggested.

It takes some time for the new release to propagate to the Maven Central Repository, so you may not be able to download it immediately. I will post an announcement here when it's fully available.

Tianyu ZUO

unread,
Feb 23, 2016, 11:39:03 AM2/23/16
to Tcases Forum
Downloaded the 1.5.4 version and it can run smooth on my non-Oracle JVM, thanks :)
Reply all
Reply to author
Forward
0 new messages