I have implemented and verified the fix for the method accessibility
race condition. The fix was to just make no-public methods accessible.
The patch changes org.testng.internal.MethodInvocationHelper from:
70 boolean isPublic =
Modifier.isPublic(thisMethod.getModifiers());
71
72 try {
73 if (!isPublic) {
74 thisMethod.setAccessible(true);
75 }
76 result = thisMethod.invoke(instance, parameters);
77 }
78 finally {
79 if (!isPublic) {
80 thisMethod.setAccessible(false);
81 }
82 }
83
84 return result;
to:
70 synchronized (thisMethod) {
71 if (!Modifier.isPublic(thisMethod.getModifiers())) {
72 thisMethod.setAccessible(true);
73 }
74 }
75
76 return thisMethod.invoke(instance, parameters);
The corresponding patch is:
--- cbeust-testng-testng-6.0.1-0-gea2c4e7-1/cbeust-testng-ee25c93/src/
main/java/org/testng/internal/MethodInvocationHelper.java 2011-03-24
13:09:34.000000000 -0700
+++ cbeust-testng-testng-6.0.1-1-gea2c4e7-1/cbeust-testng-ee25c93/src/
main/java/org/testng/internal/MethodInvocationHelper.java 2011-06-22
10:18:16.000000000 -0700
@@ -67,21 +67,13 @@
}
}
- boolean isPublic = Modifier.isPublic(thisMethod.getModifiers());
-
- try {
- if (!isPublic) {
+ synchronized (thisMethod) {
+ if (!Modifier.isPublic(thisMethod.getModifiers())) {
thisMethod.setAccessible(true);
}
- result = thisMethod.invoke(instance, parameters);
- }
- finally {
- if (!isPublic) {
- thisMethod.setAccessible(false);
- }
}
- return result;
+ return thisMethod.invoke(instance, parameters);
}
protected static Iterator<Object[]> invokeDataProvider(Object
instance,
Cheers,
Baron
On Jun 14, 5:04 am, Baron <
baron.robe...@gmail.com> wrote:
> Will do. I'm away from my keyboard this week but will report back
> early next week.
>
> Baron
>
> Cédric Beust ♔ wrote:
> > Hi Baron,
>