use of jakarta.json.JsonException in project avro-util by linkedin.
the class JsonReaderWithLocations method readJsonValueInternal.
protected JsonValueExt readJsonValueInternal() {
JsonLocation endLocation;
switch(currentEvent) {
case START_ARRAY:
return readJsonArrayInternal();
case START_OBJECT:
return readObjectInternal();
case KEY_NAME:
throw new JsonException("unexpected " + currentEvent + " at " + parser.getLocation());
case VALUE_STRING:
String str = parser.getString();
endLocation = parser.getLocation();
return new JsonStringExtImpl(source, JsonPUtil.subtract(endLocation, str.length()), endLocation, str);
case VALUE_NUMBER:
// we dont bother optimizing for ints/longs
return new JsonNumberExtImpl(source, parser.getLocation(), parser.getLocation(), parser.getBigDecimal());
case VALUE_TRUE:
endLocation = parser.getLocation();
return new JsonTrueExtImpl(source, JsonPUtil.subtract(endLocation, 4), endLocation);
case VALUE_FALSE:
endLocation = parser.getLocation();
return new JsonFalseExtImpl(source, JsonPUtil.subtract(endLocation, 5), endLocation);
case VALUE_NULL:
endLocation = parser.getLocation();
return new JsonNullExtImpl(source, JsonPUtil.subtract(endLocation, 4), endLocation);
case END_ARRAY:
throw new JsonException("unexpected " + currentEvent + " at " + parser.getLocation());
case END_OBJECT:
throw new JsonException("unexpected " + currentEvent + " at " + parser.getLocation());
default:
throw new JsonException("unexpected " + currentEvent + " at " + parser.getLocation());
}
}
Aggregations