/** * Constructor. * * @param message The {@link MessageFormat}-style message. * @param args Optional {@link MessageFormat}-style arguments. */ public FormattedException(String message, Object...args) { super(format(message, args)); }
/** * Constructor. * * @param message The {@link MessageFormat}-style message. * @param args Optional {@link MessageFormat}-style arguments. */ public FormattedRuntimeException(String message, Object...args) { super(format(message, args)); }
/** * Constructor. * * @param message The {@link MessageFormat}-style message. * @param args Optional {@link MessageFormat}-style arguments. */ public FormattedRuntimeException(String message, Object...args) { super(format(message, args)); }
/** * Constructor. * * @param message The {@link MessageFormat}-style message. * @param args Optional {@link MessageFormat}-style arguments. */ public RestCallException(String message, Object...args) { super(format(message, args)); }
/** * Constructor. * * @param message The {@link MessageFormat}-style message. * @param args Optional {@link MessageFormat}-style arguments. */ public FormattedIllegalArgumentException(String message, Object...args) { super(format(message, args)); }
/** * Constructor. * * @param message The detailed message. * @param args Optional {@link MessageFormat}-style arguments. */ public RestServletException(String message, Object...args) { super(format(message, args)); }
@Override /* Object */ public String toString() { if (results == null) results = format(pattern, args); return results; } }
/** * Constructor. * * @param message The {@link MessageFormat}-style message. * @param args Optional {@link MessageFormat}-style arguments. */ public FormattedRuntimeException(String message, Object...args) { super(format(message, args)); }
private String getMessage(String msg, Object...args) { if (args.length == 0) return msg; if (rb != null && rb.containsKey(msg)) msg = rb.getString(msg); return format(msg, args); }
private String getMessage(String msg, Object...args) { if (args.length == 0) return msg; if (rb != null && rb.containsKey(msg)) msg = rb.getString(msg); return format(msg, args); }
/** * Create an exception with a simple message and the status code and body of the specified response. * * @param msg The exception message. * @param response The HTTP response object. * @throws ParseException * @throws IOException */ public RestCallException(String msg, HttpResponse response) throws ParseException, IOException { super(format("{0}\n{1}\nstatus=''{2}''\nResponse: \n{3}", msg, response.getStatusLine().getStatusCode(), EntityUtils.toString(response.getEntity(), UTF8))); }
/** * Constructor. * * @param message Message to send as the response. * @param uri URI containing {@link MessageFormat}-style arguments. * @param uriArgs {@link MessageFormat}-style arguments. */ public SeeOther(String message, String uri, Object uriArgs) { this(message, toURI(format(uri.toString(), uriArgs))); }
private static String message(Throwable cause, String msg, Object...args) { if (msg == null && cause != null) return firstNonEmpty(cause.getLocalizedMessage(), cause.getClass().getName()); return format(msg, args); }
@Override /* RestCallInterceptor */ public void onRetry(RestCall restCall, int statusCode, HttpRequest req, HttpResponse res, Exception ex) { if (log.isLoggable(level)) { if (ex == null) log.log(level, format("Call to {0} returned {1}. Will retry.", req.getRequestLine().getUri(), statusCode)); else log.log(level, format("Call to {0} caused exception {1}. Will retry.", req.getRequestLine().getUri(), ex.getLocalizedMessage()), ex); } }
/** * Constructor. * * @param uri URI containing {@link MessageFormat}-style arguments. * @param uriArgs {@link MessageFormat}-style arguments. */ public SeeOther(String uri, Object uriArgs) { this(toURI(format(uri.toString(), uriArgs))); }
/** * Logs a warning message. * * @param msg The warning message. * @param args Optional {@link MessageFormat}-style arguments. */ public final void addWarning(String msg, Object... args) { if (warnings == null) warnings = new LinkedList<>(); getLogger().warning(msg, args); warnings.add((warnings.size() + 1) + ": " + format(msg, args)); }
private static String getMessage(SerializerSession session, String msg, Object... args) { msg = format(msg, args); if (session != null) { Map<String,Object> m = session.getLastLocation(); if (m != null && ! m.isEmpty()) msg = "Serialize exception occurred at " + SimpleJsonSerializer.DEFAULT.toString(m) + ". " + msg; } return msg; }
private static String getMessage(SerializerSession session, String msg, Object... args) { msg = format(msg, args); if (session != null) { Map<String,Object> m = session.getLastLocation(); if (m != null && ! m.isEmpty()) msg = "Serialize exception occurred at " + SimpleJsonSerializer.DEFAULT.toString(m) + ". " + msg; } return msg; }
private static String getMessage(SerializerSession session, String msg, Object... args) { msg = format(msg, args); if (session != null) { Map<String,Object> m = session.getLastLocation(); if (m != null && ! m.isEmpty()) msg = "Serialize exception occurred at " + SimpleJsonSerializer.DEFAULT.toString(m) + ". " + msg; } return msg; }
/** * Called when an exception is thrown when trying to call a bean getter method. * * @param session The serializer session. * @param t The throwable that was thrown by the getter method. * @param p The bean property we had an issue on. */ public void onBeanGetterException(SerializerSession session, Throwable t, BeanPropertyMeta p) { onError(session, t, format("Could not call getValue() on property ''{0}'' of class ''{1}'', exception = {2}", p.getName(), p.getBeanMeta().getClassMeta(), t.getLocalizedMessage())); }