Java IllegalAccessException -
I have a problem with my program IllegalAccessException
This is my code < Pre> I added a check logic to prevent 'IllegalAccessException' But sometimes my program comes to be illegally entered. The exception was raised on the line - 'Field. Set (DTO, value); ' The exception is belows First of all, I think that there may be a 'stable' problem. But as far as I know, static methods do their stack frames when it is called. So I could not find anything. Please tell me what I have done some stupid My program runs on Spring 3.x and Java 1.6 Please try the code above and it should work (I did not compile it, if any syntax errors are checked) So how did you get the field frequency? There may be some problems in it Private static zero setdata (field field, object DTO, object value) is sold invalid, option, IllegalAccessException {Boolean accessible = field. This access (); If (! Accessible) field.Set disabled (true); If (value instanceof java.lang.String) {if (value! = Null) {value = String.valueOf (value) .trim (); }} Field.set (dto, value); If (accessible) field.setAccessible (false); }
Boolean accessible = area. enter (); '
java.lang.IllegalAccessException: class com.comm.util.FileReadUtils member can not access standard com.dto.mydto With the modifier "private"
Public static zero setfield (object object, string field name, object field) {try {field field = object.getClass (). GetDeclaredField (fieldName); Field.setAccessible (true); Field.set (object, field value); } Hold (exception exception) {// log error}}
Comments
Post a Comment