[ http://jira.codehaus.org/browse/MNG-1387?page=comments#action_49940 ] 

Erick Dovale commented on MNG-1387:
-----------------------------------

I think I just figure out this problem.
As I said before the problem is caused when searching for a ( when there is 
none. 
The reason for the problem is that when creating a reportEntry in class 
org.codehaus.surefire.battery.TestListenerInvocationHandler 
more exactly in method
handleStartTest( Object[] args ) 

this is the code used to create a ReportEntry:

        ReportEntry report = new ReportEntry( args[0], args[0].toString(), 
args[0].getClass().getName() );

the name of the reportEntry, which is the 2nd parameter in the constructor is 
being populated with the result of the toString method of the testCase being 
currently run (arg[0] contains a TestCase instance).  
If someone redefines the toString method to a test case then surefire will fail 
to run it miserably because of this not too good assumption that the toString 
method of a test case will always return the method name fallowed by a ( .
I think this is a bug in surefire; clearly not related to maven it self at all. 
The good thing is that it is related to the reporting and not to the tests 
execution.

I just created an empty project with a testcase redefining its toString method 
so you can easily reproduce this issue.


> surefire plugin crashes
> -----------------------
>
>          Key: MNG-1387
>          URL: http://jira.codehaus.org/browse/MNG-1387
>      Project: Maven 2
>         Type: Bug
>   Components: maven-surefire-plugin
>     Versions: 2.0.1, 2.0
>  Environment: win XP-SP2, jvm 1.4.2_08
>     Reporter: Erick Dovale
>     Assignee: Johnny R. Ruiz III

>
>
> The surefire plugin crashes with the following exception:
> Reporter method testStarting completed abruptly with an exception.
> java.lang.StringIndexOutOfBoundsException: String index out of range: -1
>         at java.lang.String.substring(String.java:1444)
>         at 
> org.codehaus.surefire.report.XMLReporter.testStarting(XMLReporter.jav
> a:101)
>         at 
> org.codehaus.surefire.report.ReporterManager.testStarting(ReporterMan
> ager.java:304)
>         at 
> org.codehaus.surefire.battery.TestListenerInvocationHandler.handleSta
> rtTest(TestListenerInvocationHandler.java:143)
>         at 
> org.codehaus.surefire.battery.TestListenerInvocationHandler.invoke(Te
> stListenerInvocationHandler.java:120)
>         at $Proxy0.startTest(Unknown Source)
>         at junit.framework.TestResult.startTest(TestResult.java:151)
>         at junit.framework.TestResult.run(TestResult.java:103)
>         at junit.framework.TestCase.run(TestCase.java:118)
>         at junit.framework.TestSuite.runTest(TestSuite.java:208)
>         at junit.framework.TestSuite.run(TestSuite.java:203)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at 
> org.codehaus.surefire.battery.JUnitBattery.executeJUnit(JUnitBattery.
> java:246)
>         at 
> org.codehaus.surefire.battery.JUnitBattery.execute(JUnitBattery.java:
> 220)
>         at org.codehaus.surefire.Surefire.executeBattery(Surefire.java:204)
>         at org.codehaus.surefire.Surefire.run(Surefire.java:153)
>         at org.codehaus.surefire.Surefire.run(Surefire.java:77)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at org.codehaus.surefire.SurefireBooter.run(SurefireBooter.java:104)
>         at 
> org.apache.maven.test.SurefirePlugin.execute(SurefirePlugin.java:309)
>         at 
> org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPlugi
> nManager.java:412)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(Defa
> ultLifecycleExecutor.java:519)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLi
> fecycle(DefaultLifecycleExecutor.java:469)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(Defau
> ltLifecycleExecutor.java:448)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHan
> dleFailures(DefaultLifecycleExecutor.java:301)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegmen
> ts(DefaultLifecycleExecutor.java:268)
>         at 
> org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLi
> fecycleExecutor.java:137)
>         at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:322)
>         at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:115)
>         at org.apache.maven.cli.MavenCli.main(MavenCli.java:249)
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>         at java.lang.reflect.Method.invoke(Method.java:324)
>         at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
>         at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
>         at 
> org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
>         at org.codehaus.classworlds.Launcher.main(Launcher.java:375)

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to