google-code-export / protostuff

Automatically exported from code.google.com/p/protostuff
Apache License 2.0
1 stars 1 forks source link

IllegalAccessException in when accessing a private Date field with RuntimeSchema #47

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

Try serialize bean with java.util.Date field to json with RuntimeSchema

What is the expected output? What do you see instead?

JSON expected with unix timestamp for field.

But got
Exception in thread "main" java.lang.RuntimeException: 
java.lang.IllegalAccessException: Class 
com.dyuproject.protostuff.runtime.RuntimeFieldFactory$21$1 can not access a 
member of class com.tradetools.tradeplatform.servicemanager.launchers.TestBean 
with modifiers "private"
    at com.dyuproject.protostuff.runtime.RuntimeFieldFactory$21$1.writeTo(RuntimeFieldFactory.java:2705)
    at com.dyuproject.protostuff.runtime.MappedSchema.writeTo(MappedSchema.java:187)
    at com.dyuproject.protostuff.JsonIOUtil.writeTo(JsonIOUtil.java:388)
    at com.dyuproject.protostuff.JsonIOUtil.writeTo(JsonIOUtil.java:352)
    at com.tradetools.tradeplatform.servicemanager.launchers.TestProtoStuff.main(TestProtoStuff.java:30)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:115)
Caused by: java.lang.IllegalAccessException: Class 
com.dyuproject.protostuff.runtime.RuntimeFieldFactory$21$1 can not access a 
member of class com.tradetools.tradeplatform.servicemanager.launchers.TestBean 
with modifiers "private"
    at sun.reflect.Reflection.ensureMemberAccess(Reflection.java:65)
    at java.lang.reflect.Field.doSecurityCheck(Field.java:960)
    at java.lang.reflect.Field.getFieldAccessor(Field.java:896)
    at java.lang.reflect.Field.get(Field.java:358)
    at com.dyuproject.protostuff.runtime.RuntimeFieldFactory$21$1.writeTo(RuntimeFieldFactory.java:2695)
    ... 9 more

What version of the product are you using? On what operating system?

1.0.0.M7

Please provide any additional information below.

Test source code in attachment

Original issue reported on code.google.com by Kostya.H...@gmail.com on 27 Jan 2011 at 11:22

Attachments:

GoogleCodeExporter commented 9 years ago
Gah I overlooked this.
Fixed @ rev 1216
Thanks for reporting.

Original comment by david.yu...@gmail.com on 28 Jan 2011 at 12:14