Package com.restfb.exception

Examples of com.restfb.exception.FacebookJsonMappingException


      return (T) new BigDecimal(json);

    if (jsonMappingErrorHandler.handleMappingError(json, type, null))
      return null;

    throw new FacebookJsonMappingException("Don't know how to map JSON to " + type
        + ". Are you sure you're mapping to the right class? " + "Offending JSON is '" + json + "'.");
  }
View Full Code Here


    try {
      Constructor<T> defaultConstructor = type.getDeclaredConstructor();

      if (defaultConstructor == null)
        throw new FacebookJsonMappingException("Unable to find a default constructor for " + type);

      // Allows protected, private, and package-private constructors to be
      // invoked
      defaultConstructor.setAccessible(true);
      return defaultConstructor.newInstance();
    } catch (Exception e) {
      throw new FacebookJsonMappingException(errorMessage, e);
    }
  }
View Full Code Here

      return objectType.equals(JsonObject.class) ? (T) jsonObject
          : jsonMapper
              .toJavaObject(jsonObject.toString(), objectType);
    } catch (JsonException e) {
      throw new FacebookJsonMappingException(
          "Unable to map connection JSON to Java objects", e);
    }
  }
View Full Code Here

      return objectType.equals(JsonObject.class) ? (T) normalizedJson
          : jsonMapper.toJavaObject(normalizedJson.toString(),
              objectType);
    } catch (JsonException e) {
      throw new FacebookJsonMappingException(
          "Unable to process fql.multiquery JSON response", e);
    }
  }
View Full Code Here

      throw graphFacebookExceptionMapper.exceptionForTypeAndMessage(null,
          innerErrorObject.getString(ERROR_TYPE_ATTRIBUTE_NAME),
          innerErrorObject.getString(ERROR_MESSAGE_ATTRIBUTE_NAME));
    } catch (JsonException e) {
      throw new FacebookJsonMappingException(
          "Unable to process the Facebook API response", e);
    }
  }
View Full Code Here

      throw legacyFacebookExceptionMapper.exceptionForTypeAndMessage(
          errorObject.getInt(BATCH_ERROR_ATTRIBUTE_NAME), null,
          errorObject
              .getString(BATCH_ERROR_DESCRIPTION_ATTRIBUTE_NAME));
    } catch (JsonException e) {
      throw new FacebookJsonMappingException(
          "Unable to process the Facebook API response", e);
    }
  }
View Full Code Here

      Class<T> connectionType, String fullUrl, long page) {
    this.page = page;
    List<T> data = new ArrayList<T>();

    if (json == null)
      throw new FacebookJsonMappingException(
          "You must supply non-null connection JSON.");

    JsonObject jsonObject = null;

    try {
      jsonObject = new JsonObject(json);
    } catch (JsonException e) {
      throw new FacebookJsonMappingException(
          "The connection JSON you provided was invalid: " + json, e);
    }

    // Pull out data
    JsonObject hits = jsonObject.getJsonObject("hits");
View Full Code Here

      throw legacyFacebookExceptionMapper.exceptionForTypeAndMessage(
        errorObject.getInt(LEGACY_ERROR_CODE_ATTRIBUTE_NAME), null,
        errorObject.getString(LEGACY_ERROR_MSG_ATTRIBUTE_NAME));
    } catch (JsonException e) {
      throw new FacebookJsonMappingException("Unable to process the Facebook API response", e);
    }
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  public Connection(FacebookClient facebookClient, String json, Class<T> connectionType) {
    List<T> data = new ArrayList<T>();

    if (json == null)
      throw new FacebookJsonMappingException("You must supply non-null connection JSON.");

    JsonObject jsonObject = null;

    try {
      jsonObject = new JsonObject(json);
    } catch (JsonException e) {
      throw new FacebookJsonMappingException("The connection JSON you provided was invalid: " + json, e);
    }

    // Pull out data
    JsonArray jsonData = jsonObject.getJsonArray("data");
    for (int i = 0; i < jsonData.length(); i++)
View Full Code Here

      throw legacyFacebookExceptionMapper.exceptionForTypeAndMessage(
        errorObject.getInt(LEGACY_ERROR_CODE_ATTRIBUTE_NAME), null, httpStatusCode, null,
        errorObject.getString(LEGACY_ERROR_MSG_ATTRIBUTE_NAME));
    } catch (JsonException e) {
      throw new FacebookJsonMappingException("Unable to process the Facebook API response", e);
    }
  }
View Full Code Here

TOP

Related Classes of com.restfb.exception.FacebookJsonMappingException

Copyright © 2018 www.massapicom. 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.