Package com.google.api.client.json

Examples of com.google.api.client.json.JsonObjectParser.parseAndClose()


        if (content == null) {
          // Throw explicitly rather than allow a later null reference as default mock
          // transports return success codes with empty contents.
          throw new IOException("Empty content from metadata token server request.");
        }
        return parser.parseAndClose(content, response.getContentCharset(), TokenResponse.class);
      }
      if (statusCode == HttpStatusCodes.STATUS_CODE_NOT_FOUND) {
        throw new IOException(String.format("Error code %s trying to get security access token from"
            + " Compute Engine metadata for the default service account. This may be because"
            + " the virtual machine instance does not have permission scopes specified.",
View Full Code Here


    Preconditions.checkNotNull(credentialStream);
    Preconditions.checkNotNull(transport);
    Preconditions.checkNotNull(jsonFactory);

    JsonObjectParser parser = new JsonObjectParser(jsonFactory);
    GenericJson fileContents = parser.parseAndClose(
        credentialStream, OAuth2Utils.UTF_8, GenericJson.class);
    String fileType = (String) fileContents.get("type");
    if (fileType == null) {
      throw new IOException("Error reading credentials from stream, 'type' field not specified.");
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.