Peter Lynch created SUREFIRE-916:
------------------------------------

             Summary: surefire.junit4.upgradecheck fails with 
ClassCastException: java.lang.Class cannot be cast to java.lang.String
                 Key: SUREFIRE-916
                 URL: https://jira.codehaus.org/browse/SUREFIRE-916
             Project: Maven Surefire
          Issue Type: Bug
          Components: Junit 4.x support
    Affects Versions: 2.12.4
            Reporter: Peter Lynch
         Attachments: 
fix_surefire_junit4_upgradecheck_to_not_fail_with_ClassCastException1.patch

I specified {{-Dsurefire.junit4.upgradecheck}} on a project which had at least 
one class found to be affected by the check.

Instead of reporting the affected classes, the check fails with 

{noformat}
org.apache.maven.surefire.util.SurefireReflectionException: 
java.lang.reflect.InvocationTargetException; nested exception is 
java.lang.reflect.InvocationTargetException: null
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at 
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at 
org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
        at 
org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
        at 
org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
        at 
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
        at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: java.lang.ClassCastException: java.lang.Class cannot be cast to 
java.lang.String
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.upgradeCheck(JUnit4Provider.java:211)
        at 
org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:95)
        ... 9 more

{noformat}

Attached patch fixes the problem.

Method was private and was 'unsupported' feature meant to eventually go away so 
didn't file a test, but I think the code is pretty obvious.



--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to