throw new OAuthRuntimeException(format("String '%s' is not a valid JSON object representation, a JSON object text must begin with '{'", body)); switch (c) { case 0: throw new OAuthRuntimeException(format("String '%s' is not a valid JSON object representation, a JSON object text must end with '}'", body)); case '}': throw new OAuthRuntimeException(format("String '%s' is not a valid JSON object representation, expected a ':' after the key '%s'", body, key)); return Collections.unmodifiableMap(parameters); default: throw new OAuthRuntimeException(format("String '%s' is not a valid JSON object representation, Expected a ',' or '}", body));
/** * Lazily read JSON from request * * @throws OAuthProblemException */ private String readJsonBody() { try { final ServletRequest request = getRequest(); String contentType = request.getContentType(); final String expectedContentType = OAuth.ContentType.JSON; if (!OAuthUtils.hasContentType(contentType, expectedContentType)) { return ""; } final ServletInputStream inputStream = request.getInputStream(); if (inputStream == null) { return ""; } bodyRead = true; return OAuthUtils.saveStreamAsString(inputStream); } catch (Exception e) { log.error("Dynamic client registration error: ", e); throw new OAuthRuntimeException("OAuth server error"); } } }
/** * Lazily read JSON from request * * @throws OAuthProblemException */ private String readJsonBody() { try { final ServletRequest request = getRequest(); String contentType = request.getContentType(); final String expectedContentType = OAuth.ContentType.JSON; if (!OAuthUtils.hasContentType(contentType, expectedContentType)) { return ""; } final ServletInputStream inputStream = request.getInputStream(); if (inputStream == null) { return ""; } bodyRead = true; return OAuthUtils.saveStreamAsString(inputStream); } catch (Exception e) { log.error("Dynamic client registration error: ", e); throw new OAuthRuntimeException("OAuth server error"); } } }