mirror of
https://github.com/frohoff/ysoserial.git
synced 2026-09-26 08:51:53 +08:00
Merge pull request #4 from ltearno/patch-1
Call setAccessible only once
This commit is contained in:
@@ -7,10 +7,10 @@ public class Reflections {
|
|||||||
|
|
||||||
public static Field getField(final Class<?> clazz, final String fieldName) throws Exception {
|
public static Field getField(final Class<?> clazz, final String fieldName) throws Exception {
|
||||||
Field field = clazz.getDeclaredField(fieldName);
|
Field field = clazz.getDeclaredField(fieldName);
|
||||||
if (field == null && clazz.getSuperclass() != null) {
|
if (field != null)
|
||||||
|
field.setAccessible(true);
|
||||||
|
else if (clazz.getSuperclass() != null)
|
||||||
field = getField(clazz.getSuperclass(), fieldName);
|
field = getField(clazz.getSuperclass(), fieldName);
|
||||||
}
|
|
||||||
field.setAccessible(true);
|
|
||||||
return field;
|
return field;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user