I\'m trying to use Google Gson in my Java Applet, but when I do I get
Exception in thread \"Thread-19\" java.security.AccessControlException: access deni
I solved this problem using a custom deserializer.
I had a class with two members, a timestamp and a list of doubles. This is the code that worked for me.
GsonBuilder gsonBuilder = new GsonBuilder();
gsonBuilder.registerTypeAdapter(TimestampedValueList.class, new JsonDeserializer() {
@Override
public TimestampedValueList deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
long timestampMs = json.getAsJsonObject().get("timestampMs").getAsLong();
double[] valueList = context.deserialize(json.getAsJsonObject().get("valueList"), double[].class);
return new TimestampedValueList(timestampMs, valueList);
}
});
gson = gsonBuilder.create();
Hope this can help anyone!