Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.12.4
-
None
-
Patch
Description
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
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
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.