Java IllegalAccessException -


I have a problem with my program IllegalAccessException

This is my code < Pre> 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); }

I added a check logic to prevent 'IllegalAccessException'

Boolean accessible = area. enter (); '

But sometimes my program comes to be illegally entered.

The exception was raised on the line - 'Field. Set (DTO, value); '

The exception is belows

  java.lang.IllegalAccessException: class com.comm.util.FileReadUtils member can not access standard com.dto.mydto With the modifier "private"   

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

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}}

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

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -