Package org.archive.wayback.exception

Examples of org.archive.wayback.exception.BadQueryException


    String urlKey;
    try {
      urlKey = canonicalizer.urlStringToKey(wbRequest.getRequestUrl());
    } catch (IOException e) {
      throw new BadQueryException("Bad URL(" +
          wbRequest.getRequestUrl() + ")");
    }
   
    // Special handling for index where the key is url<space>timestamp
    // for faster binary search lookup
View Full Code Here


   
    String urlKey;
    try {
      urlKey = canonicalizer.urlStringToKey(wbRequest.getRequestUrl());
    } catch (URIException e) {
      throw new BadQueryException("Bad URL(" +
          wbRequest.getRequestUrl() + ")");
    }
   
    if (markPrefixQueries) {
      urlKey += "*\t";
 
View Full Code Here

      results.putFilter(WaybackRequest.REQUEST_TYPE,
          WaybackRequest.REQUEST_URL_QUERY);

    } else {

      throw new BadQueryException("Unknown query type, must be "
          + WaybackRequest.REQUEST_REPLAY_QUERY
          + ", " + WaybackRequest.REQUEST_CAPTURE_QUERY
          + ", or " + WaybackRequest.REQUEST_URL_QUERY);
    }
    return results;
View Full Code Here

      if(errTitle == null) {
        throw new ResourceIndexNotAvailableException("Unknown error!");
      } else if(errTitle.equals("Resource Not In Archive")) {
        throw new ResourceNotInArchiveException(errMessage);
      } else if(errTitle.equals("Bad Query Exception")) {
        throw new BadQueryException(errMessage);
      } else if(errTitle.equals("Resource Index Not Available Exception")) {
        throw new ResourceIndexNotAvailableException(errMessage);
      } else if(errTitle.equals("Access Control Exception")) {
        throw new AccessControlException(errMessage);
      } else {
View Full Code Here

    String[] parts = WHITESPACE_PATTERN.split(query);
    for (int i = 0; i < parts.length; i++) {
      String token = parts[i];
      int colonIndex = token.indexOf(":");
      if (colonIndex == -1) {
        throw new BadQueryException("Bad search token(" + token + ")");
      }
      try {
        String key = URLDecoder.decode(token.substring(0, colonIndex),
            "UTF-8");
        String value = URLDecoder.decode(
            token.substring(colonIndex + 1), "UTF-8");
        // TODO: make sure key is in singleTokens?
        // let's just let em all thru for now:
        wbRequest.put(key, value);
      } catch (UnsupportedEncodingException e) {
        throw new BadQueryException("Unsupported encoding: UTF-8");
      }
    }
    if (wbRequest.getStartTimestamp() == null) {
      wbRequest.setStartTimestamp(getEarliestTimestamp());
    }
View Full Code Here

    }

 
    String searchUrl = wbRequest.getRequestUrl();
    if (searchUrl == null) {
      throw new BadQueryException("No " + WaybackRequest.REQUEST_URL
          + " specified");
    }

    try {
      keyUrl = canonicalizer.urlStringToKey(searchUrl);
    } catch (URIException e) {
      throw new BadQueryException("invalid "
          + WaybackRequest.REQUEST_URL + " " + searchUrl);
    }
    RangeGroup dummy = new RangeGroup("",keyUrl,"");
    int loc = Arrays.binarySearch(groups,dummy,comparator);
    if(loc < 0) {
View Full Code Here

    // URL-Filters:
    chain = new ObjectFilterChain<CaptureSearchResult>();
    try {
      keyUrl = canonicalizer.urlStringToKey(request.getRequestUrl());
    } catch (IOException e) {
      throw new BadQueryException("Bad request URL(" +
          request.getRequestUrl() +")");
    }
    // Date-Filters:
    startDate = request.getStartTimestamp();
    if(startDate == null) {
View Full Code Here

    // first grab all the info from the WaybackRequest, and validate it:
    resultsPerPage = request.getResultsPerPage();
    pageNum = request.getPageNum();

    if (resultsPerPage < 1) {
      throw new BadQueryException("resultsPerPage cannot be < 1");
    }
    if (resultsPerPage > index.getMaxRecords()) {
      throw new BadQueryException("resultsPerPage cannot be > "
          + index.getMaxRecords());
    }
    if (pageNum < 1) {
      throw new BadQueryException("pageNum must be > 0");
    }
    startResult = (pageNum - 1) * resultsPerPage;
    startFilter = new WindowStartFilter<T>(startResult);
    endFilter = new WindowEndFilter<T>(resultsPerPage);
    windowFilters.addFilter(startFilter);
View Full Code Here

        throw e;
    }

    int numSeen = endFilter.getNumSeen();
    if(numSeen == 0) {
      throw new BadQueryException("No results in requested window");
    }
   
   
    // how many went by the filters:
    results.setMatchingCount(startFilter.getNumSeen());
View Full Code Here

      String field) throws BadQueryException {
    // TODO: Throw something different, org.archive.wayback.util should have
    // no references outside of org.archive.wayback.util
    String value = getMapParam(queryMap, field);
    if (value == null) {
      throw new BadQueryException("missing field " + field);
    }
    if (value.length() == 0) {
      throw new BadQueryException("empty field " + field);
    }
    return value;
  }
View Full Code Here

TOP

Related Classes of org.archive.wayback.exception.BadQueryException

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.