Package net.pterodactylus.sone.freenet.fcp

Examples of net.pterodactylus.sone.freenet.fcp.FcpException


   *             invalid
   */
  protected Optional<Sone> getSone(SimpleFieldSet simpleFieldSet, String parameterName, boolean localOnly, boolean mandatory) throws FcpException {
    String soneId = simpleFieldSet.get(parameterName);
    if (mandatory && (soneId == null)) {
      throw new FcpException("Could not load Sone ID from “" + parameterName + "”.");
    }
    Optional<Sone> sone = core.getSone(soneId);
    if ((mandatory && !sone.isPresent()) || (mandatory && sone.isPresent() && (localOnly && !sone.get().isLocal()))) {
      throw new FcpException("Could not load Sone from “" + soneId + "”.");
    }
    return sone;
  }
View Full Code Here


  protected Post getPost(SimpleFieldSet simpleFieldSet, String parameterName) throws FcpException {
    try {
      String postId = simpleFieldSet.getString(parameterName);
      Optional<Post> post = core.getPost(postId);
      if (!post.isPresent()) {
        throw new FcpException("Could not load post from “" + postId + "”.");
      }
      return post.get();
    } catch (FSParseException fspe1) {
      throw new FcpException("Could not post ID from “" + parameterName + "”.", fspe1);
    }
  }
View Full Code Here

  protected PostReply getReply(SimpleFieldSet simpleFieldSet, String parameterName) throws FcpException {
    try {
      String replyId = simpleFieldSet.getString(parameterName);
      Optional<PostReply> reply = core.getPostReply(replyId);
      if (!reply.isPresent()) {
        throw new FcpException("Could not load reply from “" + replyId + "”.");
      }
      return reply.get();
    } catch (FSParseException fspe1) {
      throw new FcpException("Could not reply ID from “" + parameterName + "”.", fspe1);
    }
  }
View Full Code Here

TOP

Related Classes of net.pterodactylus.sone.freenet.fcp.FcpException

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.