https://bz.apache.org/bugzilla/show_bug.cgi?id=63958
Bug ID: 63958
Summary: junitlauncher: StandaloneLauncher cannot parse launch
definition
Product: Ant
Version: 1.10.7
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Optional Tasks
Assignee: [email protected]
Reporter: [email protected]
Target Milestone: ---
Currently, some created launch-definition xml-files cannot be parsed by the
junitlauncher StandaloneLauncher.
This is the case if e.g. you have an element testclasses and a listener:
== Example build file ===
<junitlauncher>
<classpath refid="runtime.classpath">
</classpath>
<testclasses>
<fileset dir="classes">
<include name="**/*Test.class"/>
</fileset>
<fork></fork>
</testclasses>
<listener type="legacy-plain" sendSysOut="true" />
</junitlauncher>
======
The reason is that the StandaloneLauncher does not loop over the possible
elements but this block is only executed once.
Thus, the StandaloneLauncher can only parse launch definition files with
exactly one element of <test>, <testclasses> or <listener>.
Excerpt from StandaloneLauncher:
=== StandaloneLauncher ===
...
reader.nextTag();
reader.require(START_ELEMENT, null, null);
final String elementName = reader.getLocalName();
switch (elementName) {
case LD_XML_ELM_TEST: {
forkedLaunch.addTests(Collections.singletonList(SingleTestClass.fromForkedRepresentation(reader)));
break;
}
case LD_XML_ELM_TEST_CLASSES: {
forkedLaunch.addTests(TestClasses.fromForkedRepresentation(reader));
break;
}
case LD_XML_ELM_LISTENER: {
forkedLaunch.addListener(ListenerDefinition.fromForkedRepresentation(reader));
break;
}
}
reader.nextTag();
reader.require(END_ELEMENT, null, LD_XML_ELM_LAUNCH_DEF);
...
=======
=== Exception ===
[junitlauncher] Failed to construct definition from forked representation
[junitlauncher] at
org.apache.tools.ant.taskdefs.optional.junitlauncher.StandaloneLauncher.parseLaunchDefinition(StandaloneLauncher.java:185)
[junitlauncher] at
org.apache.tools.ant.taskdefs.optional.junitlauncher.StandaloneLauncher.main(StandaloneLauncher.java:104)
[junitlauncher] Caused by: javax.xml.stream.XMLStreamException: Event type
END_ELEMENT specified did not match with current parser event START_ELEMENT
[junitlauncher] at
java.xml/com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.require(XMLStreamReaderImpl.java:1179)
[junitlauncher] at
org.apache.tools.ant.taskdefs.optional.junitlauncher.StandaloneLauncher.parseLaunchDefinition(StandaloneLauncher.java:180)
[junitlauncher] ... 1 more
[junitlauncher] Exception in thread "main" Failed to construct definition from
forked representation
[junitlauncher] at
org.apache.tools.ant.taskdefs.optional.junitlauncher.StandaloneLauncher.parseLaunchDefinition(StandaloneLauncher.java:185)
[junitlauncher] at
org.apache.tools.ant.taskdefs.optional.junitlauncher.StandaloneLauncher.main(StandaloneLauncher.java:104)
[junitlauncher] Caused by: javax.xml.stream.XMLStreamException: Event type
END_ELEMENT specified did not match with current parser event START_ELEMENT
[junitlauncher] at
java.xml/com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl.require(XMLStreamReaderImpl.java:1179)
[junitlauncher] at
org.apache.tools.ant.taskdefs.optional.junitlauncher.StandaloneLauncher.parseLaunchDefinition(StandaloneLauncher.java:180)
[junitlauncher] ... 1 more
======
--
You are receiving this mail because:
You are the assignee for the bug.