Package com.google.gson

Examples of com.google.gson.JsonSyntaxException


      try {
        synchronized (dateFormat) {
          return dateFormat.parse(jsonElement.getAsString());
        }
      } catch (ParseException e) {
        throw new JsonSyntaxException(jsonElement.getAsString(), e);
      }
    }
View Full Code Here


          } else {
            field.read(in, instance);
          }
        }
      } catch (IllegalStateException e) {
        throw new JsonSyntaxException(e);
      } catch (IllegalAccessException e) {
        throw new AssertionError(e);
      }
      in.endObject();
      return instance;
View Full Code Here

  @Override
  public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
    try {
      return iso8601Format.parse(json.getAsString());
    } catch (ParseException e) {
      throw new JsonSyntaxException(json.getAsString(), e);
    }
  }
View Full Code Here

          } else {
            field.read(in, instance);
          }
        }
      } catch (IllegalStateException e) {
        throw new JsonSyntaxException(e);
      } catch (IllegalAccessException e) {
        throw new AssertionError(e);
      }
      in.endObject();
      return instance;
View Full Code Here

    }
    try {
      Date date = format.parse(in.nextString());
      return new Time(date.getTime());
    } catch (ParseException e) {
      throw new JsonSyntaxException(e);
    }
  }
View Full Code Here

       */
      if (isEmpty) {
        return JsonNull.INSTANCE;
      }
      // The stream ended prematurely so it is likely a syntax error.
      throw new JsonSyntaxException(e);
    } catch (MalformedJsonException e) {
      throw new JsonSyntaxException(e);
    } catch (IOException e) {
      throw new JsonIOException(e);
    } catch (NumberFormatException e) {
      throw new JsonSyntaxException(e);
    }
  }
View Full Code Here

    } catch (ParseException ignored) {
    }
    try {
      return iso8601Format.parse(json);
    } catch (ParseException e) {
      throw new JsonSyntaxException(json, e);
    }
  }
View Full Code Here

          in.beginArray(); // entry array
          K key = keyTypeAdapter.read(in);
          V value = valueTypeAdapter.read(in);
          V replaced = map.put(key, value);
          if (replaced != null) {
            throw new JsonSyntaxException("duplicate key: " + key);
          }
          in.endArray();
        }
        in.endArray();
      } else {
        in.beginObject();
        while (in.hasNext()) {
          JsonReaderInternalAccess.INSTANCE.promoteNameToValue(in);
          K key = keyTypeAdapter.read(in);
          V value = valueTypeAdapter.read(in);
          V replaced = map.put(key, value);
          if (replaced != null) {
            throw new JsonSyntaxException("duplicate key: " + key);
          }
        }
        in.endObject();
      }
      return map;
View Full Code Here

    }
    try {
      final long utilDate = format.parse(in.nextString()).getTime();
      return new java.sql.Date(utilDate);
    } catch (ParseException e) {
      throw new JsonSyntaxException(e);
    }
  }
View Full Code Here

          paramJsonReader.beginArray();
          localObject1 = this.keyTypeAdapter.read(paramJsonReader);
          localObject2 = this.valueTypeAdapter.read(paramJsonReader);
          localObject3 = localMap.put(localObject1, localObject2);
          if (localObject3 != null)
            throw new JsonSyntaxException("duplicate key: " + localObject1);
          paramJsonReader.endArray();
        }
        paramJsonReader.endArray();
      }
      else
      {
        paramJsonReader.beginObject();
        while (paramJsonReader.hasNext())
        {
          JsonReaderInternalAccess.INSTANCE.promoteNameToValue(paramJsonReader);
          localObject1 = this.keyTypeAdapter.read(paramJsonReader);
          localObject2 = this.valueTypeAdapter.read(paramJsonReader);
          localObject3 = localMap.put(localObject1, localObject2);
          if (localObject3 != null)
            throw new JsonSyntaxException("duplicate key: " + localObject1);
        }
        paramJsonReader.endObject();
      }
      return localMap;
    }
View Full Code Here

TOP

Related Classes of com.google.gson.JsonSyntaxException

Copyright © 2018 www.massapicom. 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.