Package org.hive2hive.core.exceptions

Examples of org.hive2hive.core.exceptions.GetFailedException


    }

    try {
      getWaiter.await();
    } catch (InterruptedException e) {
      getFailedException = new GetFailedException("Could not wait for getting the user profile.");
    }

    if (getFailedException != null) {
      throw getFailedException;
    }
View Full Code Here


      throw e;
    }

    UserProfile profile = entry.getUserProfile();
    if (profile == null)
      throw new GetFailedException("User Profile not found");
    return profile;
  }
View Full Code Here

    } else {
      // load latest user profile from network
      NetworkContent content = dataManager.get(parameters);
      if (content == null) {
        logger.warn("Did not find user profile. user id = '{}'", credentials.getUserId());
        entry.setGetError(new GetFailedException("User profile not found. Got null."));
      } else {
        try {
          logger.trace("Decrypting user profile with 256-bit AES key from password. user id = '{}'",
              credentials.getUserId());
          EncryptedNetworkContent encrypted = (EncryptedNetworkContent) content;
          NetworkContent decrypted = H2HEncryptionUtil.decryptAES(encrypted, userProfileEncryptionKey);
          UserProfile userProfile = (UserProfile) decrypted;
          userProfile.setVersionKey(content.getVersionKey());
          userProfile.setBasedOnKey(content.getBasedOnKey());

          // cache user profile
          cachedUserProfile = userProfile;
          // provide loaded user profile
          entry.setUserProfile(userProfile);
        } catch (DataLengthException | IllegalStateException | InvalidCipherTextException e) {
          logger.error("Cannot decrypt the user profile. reason = '{}'", e.getMessage());
          entry.setGetError(new GetFailedException(String.format("Cannot decrypt the user profile. reason = '%s'",
              e.getMessage())));
        } catch (Exception e) {
          logger.error("Cannot get the user profile. reason = '{}'", e.getMessage());
          entry.setGetError(new GetFailedException(String.format("Cannot get the user profile. reason = '%s'",
              e.getMessage())));
        }
      }
    }
  }
View Full Code Here

  private PublicKey evaluateResult(NetworkContent content, String requestingUserId)
      throws GetFailedException {
    if (content == null) {
      logger.warn("Did not find the public key of user '{}'.", requestingUserId);
      throw new GetFailedException("No public key found.");
    } else if (!(content instanceof UserPublicKey)) {
      logger.error(
          "The received content is not a user public key. Did not find the public key of user '{}'.",
          requestingUserId);
      throw new GetFailedException("Received unkown content.");
    } else {
      logger.trace("Successfully received the public key of user '{}'.", requestingUserId);
      UserPublicKey userPublicKey = (UserPublicKey) content;
      if (userPublicKey.getPublicKey() == null) {
        logger.error("User public key of user '{}' is corrupted.", requestingUserId);
        throw new GetFailedException("Received corrupted public key.");
      } else {
        logger.debug("Successfully got the public key of user '{}'.", userId);
        // store it in the cache
        publicKeyCache.put(requestingUserId, userPublicKey.getPublicKey());
        // return it
View Full Code Here

    try {
      // just get the public key. It does not produce any overhead since this call is cached or (if the
      // first time), the result will be cached, making the notification faster.
      PublicKey publicKey = keyManager.getPublicKey(friendId);
      if (publicKey == null)
        throw new GetFailedException(String.format("The friend '%s' does not seem to exist.",
            friendId));
    } catch (GetFailedException e) {
      throw new ProcessExecutionException(String.format(
          "The friend '%s' does not seem to exist. reason = '%s'", friendId, e.getMessage()));
    }
View Full Code Here

TOP

Related Classes of org.hive2hive.core.exceptions.GetFailedException

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.