typhoid / google-gson

Automatically exported from code.google.com/p/google-gson
0 stars 0 forks source link

Security Exception Reflection Problem in an applet #492

Closed GoogleCodeExporter closed 9 years ago

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

Create a not signed applet with this code inside (for example init-method):
--------------
                String jsonString ="{"+
                        "'date' : '1.1.1955',"+
                        "'numbers' :  [1,2,3,4,5,6,7,8,9],"+
                        "}";

                GsonBuilder gb = new GsonBuilder();
                gb.setDateFormat("dd.MM.yyyy");
                Gson gson = gb.create();

                Data data = gson.fromJson(jsonString, Data.class);

--------------
                class Data {
                    public Date date;
                    public int [] numbers;
                    public Data() {}
                    ... getter and setter...
                }
--------------

What is the expected output? 
No security exceptions within an applet.

What do you see instead?
Security Exception, because reflection is used with "setAccessible".

What version of the product are you using? On what operating system?
Gson 2.2.2., Applet Java 1.7, Applet using JNLP.

Please provide any additional information below.
Code should work in an applet without any additional privilege.

Original issue reported on code.google.com by uhenni...@googlemail.com on 27 Dec 2012 at 1:11

GoogleCodeExporter commented 9 years ago
Applets are intentionally unsupported.

Original comment by limpbizkit on 4 Feb 2013 at 3:57