google-code-export / protostuff

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

Error with protostuff-runtime 1.05 #121

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hi,

Just update to protostuff 1.05 and got the following error when try to 
serialize an object to json format

java.lang.SecurityException: Can not make a java.lang.Class constructor 
accessible
    at java.lang.reflect.AccessibleObject.setAccessible0(AccessibleObject.java:118)
    at java.lang.reflect.AccessibleObject.setAccessible(AccessibleObject.java:108)
    at com.dyuproject.protostuff.runtime.RuntimeEnv$DefaultInstantiator.<init>(RuntimeEnv.java:243)
    at com.dyuproject.protostuff.runtime.RuntimeEnv.newInstantiator(RuntimeEnv.java:200)
    at com.dyuproject.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:238)
    at com.dyuproject.protostuff.runtime.RuntimeSchema.createFrom(RuntimeSchema.java:156)
    at com.dyuproject.protostuff.runtime.DefaultIdStrategy$Lazy.getSchema(DefaultIdStrategy.java:501)
    at com.dyuproject.protostuff.runtime.RuntimeMessageField.getSchema(RuntimeMessageField.java:51)
    at com.dyuproject.protostuff.runtime.RuntimeUnsafeFieldFactory$13$1.writeTo(RuntimeUnsafeFieldFactory.java:777)
    at com.dyuproject.protostuff.runtime.MappedSchema.writeTo(MappedSchema.java:195)
    at com.dyuproject.protostuff.JsonIOUtil.writeTo(JsonIOUtil.java:470)
    at com.dyuproject.protostuff.JsonIOUtil.writeTo(JsonIOUtil.java:452)
    at com.anabatic.model.ModelSchema.toString(ModelSchema.java:158)
    at com.anabatic.model.TestModelSchema.test(TestModelSchema.java:23)

The same code working fine with protostuff-runtime 1.04 . Currently for the 
work around, I'm moving back to protostuff-runtime 1.04, the other package is 
fine for 1.05, only the protostuff-runtime package that causing that error

FYI, the class that got an error serialization has following field member :
   private final Class<?> modelClass;
   private final Map<String,Property> properties;
   private final boolean pseudo;

and the class has an inner class

Original issue reported on code.google.com by zean00z...@gmail.com on 4 May 2012 at 3:53

GoogleCodeExporter commented 9 years ago
Class serialization (optimal) is addressed in 1.0.6 (now available in trunk).
See http://code.google.com/p/protostuff/issues/detail?id=110

Original comment by david.yu...@gmail.com on 4 May 2012 at 3:04