This should not be a security manager problem - you will get a SecurityException or a subclass.
The code levelField.getInt(*this*) does not look right ...
You must pass an instance of MessageInfo as a parameter.
Are you calling this from the MessageInfo class? (why?!?) or a subclass of MessageInfo ? (Trying to make a private superclass field acts as if it were protected? Does MessageInfo a getLevel() method? If so, you can call super.getLevel() to get the value, rather than trying it that way.)
If it is not MessageInfo or a subclass, your problem is that you have a level field in the MessageInfo class and you are trying to get the value of this field from the current class. Although this should be IllegalArgumentExeception instead of IllegalAccessException ...
If this is truly an "IllegalAccessExeception" - try putting some records inside this if (levelField == null) block - make sure it is really exececuted. The field is static - there may be some other instance or method setting a value on it.
Nate
source share