@Deprecated // since 2.9 public void reportWrongTokenException(JsonParser p, JsonToken expToken, String msg, Object... msgArgs) throws JsonMappingException { msg = _format(msg, msgArgs); throw wrongTokenException(p, expToken, msg); }
/** * Fallback method that may be called if no other <code>reportXxx</code> * is applicable -- but only in that case. * * @since 2.8 * * @deprecated Since 2.9: use a more specific method, or {@link #reportBadDefinition(JavaType, String)}, * or {@link #reportInputMismatch} instead */ @Deprecated // since 2.9 public void reportMappingException(String msg, Object... msgArgs) throws JsonMappingException { throw JsonMappingException.from(getParser(), _format(msg, msgArgs)); }
/** * Helper method for constructing generic mapping exception with specified * message and current location information * Note that application code should almost always call * one of <code>handleXxx</code> methods, or {@link #reportMappingException(String, Object...)} * instead. * * @since 2.6 * * @deprecated Since 2.9 use more specific error reporting methods instead */ @Deprecated public JsonMappingException mappingException(String msg, Object... msgArgs) { return JsonMappingException.from(getParser(), _format(msg, msgArgs)); }
/** * Helper method used to indicate a problem with input in cases where more * specific <code>reportXxx()</code> method was not available. * * @since 2.9 */ public <T> T reportInputMismatch(Class<?> targetType, String msg, Object... msgArgs) throws JsonMappingException { msg = _format(msg, msgArgs); throw MismatchedInputException.from(getParser(), targetType, msg); }
/** * Helper method used to indicate a problem with input in cases where more * specific <code>reportXxx()</code> method was not available. * * @since 2.9 */ public <T> T reportInputMismatch(JavaType targetType, String msg, Object... msgArgs) throws JsonMappingException { msg = _format(msg, msgArgs); throw MismatchedInputException.from(getParser(), targetType, msg); }
/** * Method for deserializers to call * when the token encountered was of type different than what <b>should</b> * be seen at that position, usually within a sequence of expected tokens. * Note that this method will throw a {@link JsonMappingException} and no * recovery is attempted (via {@link DeserializationProblemHandler}, as * problem is considered to be difficult to recover from, in general. * * @since 2.9 */ public void reportWrongTokenException(Class<?> targetType, JsonToken expToken, String msg, Object... msgArgs) throws JsonMappingException { msg = _format(msg, msgArgs); throw wrongTokenException(getParser(), targetType, expToken, msg); }
/** * Method for deserializers to call * when the token encountered was of type different than what <b>should</b> * be seen at that position, usually within a sequence of expected tokens. * Note that this method will throw a {@link JsonMappingException} and no * recovery is attempted (via {@link DeserializationProblemHandler}, as * problem is considered to be difficult to recover from, in general. * * @since 2.9 */ public void reportWrongTokenException(JavaType targetType, JsonToken expToken, String msg, Object... msgArgs) throws JsonMappingException { msg = _format(msg, msgArgs); throw wrongTokenException(getParser(), targetType, expToken, msg); }
/** * Helper method called to indicate problem in POJO (serialization) definitions or settings * regarding specific Java type, unrelated to actual JSON content to map. * Default behavior is to construct and throw a {@link JsonMappingException}. * * @since 2.9 */ public <T> T reportBadTypeDefinition(BeanDescription bean, String msg, Object... msgArgs) throws JsonMappingException { msg = _format(msg, msgArgs); String beanDesc = ClassUtil.nameOf(bean.getBeanClass()); msg = String.format("Invalid type definition for type %s: %s", beanDesc, msg); throw InvalidDefinitionException.from(_parser, msg, bean, null); }
/** * Helper method used to indicate a problem with input in cases where more * specific <code>reportXxx()</code> method was not available. * * @since 2.9 */ public <T> T reportInputMismatch(JsonDeserializer<?> src, String msg, Object... msgArgs) throws JsonMappingException { msg = _format(msg, msgArgs); throw MismatchedInputException.from(getParser(), src.handledType(), msg); }
/** * Helper method used to indicate a problem with input in cases where more * specific <code>reportXxx()</code> method was not available. * * @since 2.9 */ public <T> T reportInputMismatch(BeanProperty prop, String msg, Object... msgArgs) throws JsonMappingException { msg = _format(msg, msgArgs); JavaType type = (prop == null) ? null : prop.getType(); throw MismatchedInputException.from(getParser(), type, msg); }
/** * Method for deserializers to call * when the token encountered was of type different than what <b>should</b> * be seen at that position, usually within a sequence of expected tokens. * Note that this method will throw a {@link JsonMappingException} and no * recovery is attempted (via {@link DeserializationProblemHandler}, as * problem is considered to be difficult to recover from, in general. * * @since 2.9 */ public void reportWrongTokenException(JsonDeserializer<?> deser, JsonToken expToken, String msg, Object... msgArgs) throws JsonMappingException { msg = _format(msg, msgArgs); throw wrongTokenException(getParser(), deser.handledType(), expToken, msg); }
/** * Helper method called to indicate problem in POJO (serialization) definitions or settings * regarding specific property (of a type), unrelated to actual JSON content to map. * Default behavior is to construct and throw a {@link JsonMappingException}. * * @since 2.9 */ public <T> T reportBadPropertyDefinition(BeanDescription bean, BeanPropertyDefinition prop, String msg, Object... msgArgs) throws JsonMappingException { msg = _format(msg, msgArgs); String propName = ClassUtil.nameOf(prop); String beanDesc = ClassUtil.nameOf(bean.getBeanClass()); msg = String.format("Invalid definition for property %s (of type %s): %s", propName, beanDesc, msg); throw InvalidDefinitionException.from(_parser, msg, bean, prop); }
msg = _format(msg, msgArgs); LinkedNode<DeserializationProblemHandler> h = _config.getProblemHandlers(); while (h != null) {
throws IOException msg = _format(msg, msgArgs); LinkedNode<DeserializationProblemHandler> h = _config.getProblemHandlers(); while (h != null) { return key; throw weirdNumberException(value, targetClass, _format( "DeserializationProblemHandler.handleWeirdNumberValue() for type %s returned value of type %s", targetClass, key.getClass()));
public Object handleWeirdNativeValue(JavaType targetType, Object badValue, JsonParser p) throws IOException { LinkedNode<DeserializationProblemHandler> h = _config.getProblemHandlers(); final Class<?> raw = targetType.getRawClass(); for (; h != null; h = h.next()) { // Can bail out if it's handled Object goodValue = h.value().handleWeirdNativeValue(this, targetType, badValue, p); if (goodValue != DeserializationProblemHandler.NOT_HANDLED) { // Sanity check for broken handlers, otherwise nasty to debug: if ((goodValue == null) || raw.isInstance(goodValue)) { return goodValue; } throw JsonMappingException.from(p, _format( "DeserializationProblemHandler.handleWeirdNativeValue() for type %s returned value of type %s", targetType, goodValue.getClass())); } } throw weirdNativeValueException(badValue, raw); }
msg = _format(msg, msgArgs); LinkedNode<DeserializationProblemHandler> h = _config.getProblemHandlers(); while (h != null) {
throws IOException msg = _format(msg, msgArgs); LinkedNode<DeserializationProblemHandler> h = _config.getProblemHandlers(); while (h != null) {
p = getParser(); msg = _format(msg, msgArgs); LinkedNode<DeserializationProblemHandler> h = _config.getProblemHandlers(); while (h != null) {
@Deprecated // since 2.9 public void reportWrongTokenException(JsonParser p, JsonToken expToken, String msg, Object... msgArgs) throws JsonMappingException { msg = _format(msg, msgArgs); throw wrongTokenException(p, expToken, msg); }
/** * Helper method used to indicate a problem with input in cases where more * specific <code>reportXxx()</code> method was not available. * * @since 2.9 */ public <T> T reportInputMismatch(JsonDeserializer<?> src, String msg, Object... msgArgs) throws JsonMappingException { msg = _format(msg, msgArgs); throw MismatchedInputException.from(getParser(), src.handledType(), msg); }