You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bu...@apache.org on 2019/11/25 07:17:01 UTC

[Bug 63958] New: junitlauncher: StandaloneLauncher cannot parse launch definition

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: notifications@ant.apache.org
          Reporter: jan.marten@gmx.de
  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.

[Bug 63958] junitlauncher: StandaloneLauncher cannot parse launch definition

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=63958

Jaikiran Pai <ja...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |1.10.8

--- Comment #1 from Jaikiran Pai <ja...@apache.org> ---
Thank you for reporting this. This indeed is a bug and I've pushed a fix for
this upstream. Fix should be available in 1.10.8 release.

-- 
You are receiving this mail because:
You are the assignee for the bug.