posix4e / json-smart

Automatically exported from code.google.com/p/json-smart
1 stars 0 forks source link

java.lang.SecurityException: Prohibited package name: java.lang #43

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
See the attached file for a JUnit test that reproduces the bug. 

Here's the StackTrace:
java.lang.SecurityException: Prohibited package name: java.lang
    at java.lang.ClassLoader.preDefineClass(ClassLoader.java:649)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:785)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
    at net.minidev.asm.DynamicClassLoader.defineClass(DynamicClassLoader.java:86)
    at net.minidev.asm.BeansAccessBuilder.bulid(BeansAccessBuilder.java:313)
    at net.minidev.asm.BeansAccess.get(BeansAccess.java:105)
    at net.minidev.json.mapper.BeansMapper$Bean.<init>(BeansMapper.java:40)
    at net.minidev.json.mapper.Mapper.getMapper(Mapper.java:105)
    at net.minidev.json.mapper.Mapper.getMapper(Mapper.java:75)
    at net.minidev.json.mapper.BeansMapper$Bean.startObject(BeansMapper.java:83)
    at net.minidev.json.parser.JSONParserBase.readMain(JSONParserBase.java:387)
    at net.minidev.json.parser.JSONParserBase.readObject(JSONParserBase.java:530)
    at net.minidev.json.parser.JSONParserBase.readFirst(JSONParserBase.java:285)
    at net.minidev.json.parser.JSONParserBase.parse(JSONParserBase.java:150)
    at net.minidev.json.parser.JSONParserString.parse(JSONParserString.java:57)
    at net.minidev.json.parser.JSONParser.parse(JSONParser.java:253)
    at net.minidev.json.JSONValue.parse(JSONValue.java:210)
    at JsonSmartTest.doTest(JsonSmartTest.java:17)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

I suppose you're not type-guessing. I would expect "obj" to be recognized as a 
json hash and so be decoded as a generic Map<String, Object>

Original issue reported on code.google.com by lau.thou...@gmail.com on 21 Jan 2014 at 10:52

Attachments:

GoogleCodeExporter commented 9 years ago
I know this bug, currently you can not use Map<String, Object> in your Holder 
class, to make it work, replace the interface by the class ex: TreeMap<String, 
Object>, or HashMap<String, Object>, Or JsonObject.

Original comment by uriel.chemouni on 30 Jan 2014 at 11:38

GoogleCodeExporter commented 9 years ago
I encounter this problem too! I'm trying to use the concrete class like 
HashMap<String, object>, but it's not work.

Original comment by 271803...@qq.com on 28 May 2014 at 9:22

GoogleCodeExporter commented 9 years ago
This bug is now Fixed on Git Server.

PS: the json-smart is now hosted on GitHub
https://github.com/netplex/json-smart-v1

and

https://github.com/netplex/json-smart-v2

the Bug had been localized and fix in asm-1.0-RC3 package.

The official released wille be published on the end of juin 2014

Original comment by uriel.chemouni on 5 Jun 2014 at 10:48