-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
Jenkins LTS 1.596.1, Testng-plugin 1.9.1, Redhat RHEL 6.5, Hotspot JDK 1.8
Profiling Jenkins startup, with jobs using testng plugin, I found parsing returning null, and cod generating Illegal Argument exceptions when using that with Enum class.
Added System.out.println debugging load time of testng and discovered that every other call in ResultsParser.java to xmlPullParser.nextToken() returns 'null':
parse: name(testng-results) tag(TESTNG_RESULTS) event(2)
parse: name(null) tag(UNKNOWN) event(4)
parse: name(reporter-output) tag(REPORTER_OUTPUT) event(2)
parse: name(null) tag(UNKNOWN) event(4)
parse: name(reporter-output) tag(REPORTER_OUTPUT) event(3)
parse: name(null) tag(UNKNOWN) event(4)
parse: name(suite) tag(SUITE) event(2)
parse: name(null) tag(UNKNOWN) event(4)
parse: name(groups) tag(GROUPS) event(2)
parse: name(null) tag(UNKNOWN) event(4)
parse: name(groups) tag(GROUPS) event(3)
parse: name(null) tag(UNKNOWN) event(4)
parse: name(test) tag(TEST) event(2)
parse: name(null) tag(UNKNOWN) event(4)
parse: name(class) tag(CLASS) event(2)
parse: name(null) tag(UNKNOWN) event(4)
parse: name(test-method) tag(TEST_METHOD) event(2)
parse: name(null) tag(UNKNOWN) event(4)
parse: name(params) tag(PARAMS) event(2)
parse: name(null) tag(UNKNOWN) event(4)
using code snippet:
TAGS tag = TAGS.fromString(tagName);
int eventType = xmlPullParser.getEventType();
System.out.println( "parse: name(" + xmlPullParser.getName() + ") tag(" + tag + ") event(" + eventType + ")" );
The TAGS.fromString, with null causes a Java Illegal argument exception.
The question is why does xmlPullParser.nextToken() return null every other call, and can the code short circuit on this being null instead of causing the Illegal Argument exception, and overhead?