Examples of JsonParseException


Examples of com.google.gson.JsonParseException

    String className = jsonObj.get(CLASS_META_KEY).getAsString();
    try {
      Class<?> clz = Class.forName(className);
      return jsonDeserializationContext.deserialize(jsonElement, clz);
    } catch (ClassNotFoundException e) {
      throw new JsonParseException(e);
    }
  }
View Full Code Here

Examples of com.google.gson.JsonParseException

    JsonArray events = new JsonArray();
    for (Event event : src.getEvents()) {
      try {
        events.add(EventSerializer.serialize(event, context));
      } catch (EventSerializationException e) {
        throw new JsonParseException(e);
      }
    }
    result.add(EVENTS_TAG, events);

    result.add(WAVELET_TAG, context.serialize(src.getWaveletData()));
View Full Code Here

Examples of com.google.gson.JsonParseException

    for (JsonElement element : eventsArray) {
      JsonObject eventObject = element.getAsJsonObject();
      try {
        events.add(EventSerializer.deserialize(wavelet, result, eventObject, context));
      } catch (EventSerializationException e) {
        throw new JsonParseException(e.getMessage());
      }
    }
    result.setEvents(events);
    return result;
  }
View Full Code Here

Examples of com.google.gson.JsonParseException

      final JsonDeserializationContext context) throws JsonParseException {
    if (json.isJsonNull()) {
      return null;
    }
    if (!json.isJsonArray()) {
      throw new JsonParseException("Expected array for Edit type");
    }

    final JsonArray o = (JsonArray) json;
    final int cnt = o.size();
    if (cnt < 4 || cnt % 4 != 0) {
      throw new JsonParseException("Expected array of 4 for Edit type");
    }

    if (4 == cnt) {
      return new Edit(get(o, 0), get(o, 1), get(o, 2), get(o, 3));
    }
View Full Code Here

Examples of com.google.gson.JsonParseException

  private static int get(final JsonArray a, final int idx)
      throws JsonParseException {
    final JsonElement v = a.get(idx);
    if (!v.isJsonPrimitive()) {
      throw new JsonParseException("Expected array of 4 for Edit type");
    }
    final JsonPrimitive p = (JsonPrimitive) v;
    if (!p.isNumber()) {
      throw new JsonParseException("Expected array of 4 for Edit type");
    }
    return p.getAsInt();
  }
View Full Code Here

Examples of com.massivecraft.mcore.xlib.gson.JsonParseException

    }
   
    try {
      return Streams.parse(parser);
    } catch (StackOverflowError e) {
      throw new JsonParseException("Failed parsing JSON source to Json", e);
    } catch (OutOfMemoryError e) {
      throw new JsonParseException("Failed parsing JSON source to Json", e);
    } catch (JsonParseException e) {
      throw e.getCause() instanceof EOFException ? new NoSuchElementException() : e;
    }
  }
View Full Code Here

Examples of com.mongodb.util.JSONParseException

            // object
            case '{':
                value = parseObject(name);
                break;
            default:
                throw new JSONParseException(s, pos);
        }
        return value;
    }
View Full Code Here

Examples of net.minecraft.util.com.google.gson.JsonParseException

                    }
                }

                return ichatbasecomponent;
            } else {
                throw new JsonParseException("Don\'t know how to turn " + jsonelement.toString() + " into a Component");
            }
        } else {
            JsonObject jsonobject = jsonelement.getAsJsonObject();
            Object object;

            if (jsonobject.has("text")) {
                object = new ChatComponentText(jsonobject.get("text").getAsString());
            } else {
                if (!jsonobject.has("translate")) {
                    throw new JsonParseException("Don\'t know how to turn " + jsonelement.toString() + " into a Component");
                }

                String s = jsonobject.get("translate").getAsString();

                if (jsonobject.has("with")) {
                    JsonArray jsonarray1 = jsonobject.getAsJsonArray("with");
                    Object[] aobject = new Object[jsonarray1.size()];

                    for (int i = 0; i < aobject.length; ++i) {
                        aobject[i] = this.a(jsonarray1.get(i), type, jsondeserializationcontext);
                        if (aobject[i] instanceof ChatComponentText) {
                            ChatComponentText chatcomponenttext = (ChatComponentText) aobject[i];

                            if (chatcomponenttext.getChatModifier().g() && chatcomponenttext.a().isEmpty()) {
                                aobject[i] = chatcomponenttext.g();
                            }
                        }
                    }

                    object = new ChatMessage(s, aobject);
                } else {
                    object = new ChatMessage(s, new Object[0]);
                }
            }

            if (jsonobject.has("extra")) {
                JsonArray jsonarray2 = jsonobject.getAsJsonArray("extra");

                if (jsonarray2.size() <= 0) {
                    throw new JsonParseException("Unexpected empty array of components");
                }

                for (int j = 0; j < jsonarray2.size(); ++j) {
                    ((IChatBaseComponent) object).addSibling(this.a(jsonarray2.get(j), type, jsondeserializationcontext));
                }
View Full Code Here

Examples of org.apache.jena.atlas.json.JsonParseException

        exception(message, reader.getLineNum(), reader.getColNum()) ;
    }

    private static void exception(String message, long line, long col)
    {
        throw new JsonParseException(message, (int)line, (int)col) ;
    }
View Full Code Here

Examples of org.apache.jena.atlas.json.JsonParseException

            exception(msg) ;
        nextToken() ;
    }

    final protected void exception(String msg, Object... args)
    { throw new JsonParseException(String.format(msg, args),
                                    (int)tokens.getLine(),
                                    (int)tokens.getColumn()) ; }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.