Package org.wikipediacleaner.api

Examples of org.wikipediacleaner.api.APIException


        if (statusCode != HttpStatus.SC_OK) {
          String message = "URL access returned " + HttpStatus.getStatusText(statusCode);
          log.error(message);
          if (attempt > maxTry) {
            log.warn("Error. Maximum attempts count reached.");
            throw new APIException(message);
          }
          try {
            Thread.sleep(30000);
          } catch (InterruptedException e) {
            // Nothing
          }
        } else {
          return root;
        }
      } catch (JDOMException e) {
        String message = "JDOMException: " + e.getMessage();
        log.error(message);
        if (attempt > maxTry) {
          log.warn("Error. Maximum attempts count reached.");
          throw new APIException("Error parsing XML result", e);
        }
        try {
          Thread.sleep(30000);
        } catch (InterruptedException e2) {
          // Nothing
        }
      } catch (IOException e) {
        String message = "IOException: " + e.getMessage();
        log.error(message);
        if (attempt > maxTry) {
          log.warn("Error. Maximum attempts count reached.");
          throw new APIException("Error accessing MediaWiki", e);
        }
        try {
          Thread.sleep(30000);
        } catch (InterruptedException e2) {
          // Nothing
View Full Code Here


        XPath xpaInfo = XPath.newInstance("./@info");
        while (iterErrors.hasNext()) {
          Element currentNode = (Element) iterErrors.next();
          String text = "Error reported: " + xpaCode.valueOf(currentNode) + " - " + xpaInfo.valueOf(currentNode);
          log.warn(text);
          throw new APIException(text, xpaCode.valueOf(currentNode));
        }
      }
    } catch (JDOMException e) {
      log.error("JDOMException: " + e.getMessage());
    }
View Full Code Here

            new MagicWord(magicWord, aliases, caseSensitive));
      }
      wikiConfiguration.setMagicWords(magicWords);
    } catch (JDOMException e) {
      log.error("Error loading namespaces", e);
      throw new APIException("Error parsing XML", e);
    }
  }
View Full Code Here

      return shouldContinue(
          root, "/api/query-continue/abusefilters",
          properties);
    } catch (JDOMException e) {
      log.error("Error loading abuse filters list", e);
      throw new APIException("Error parsing XML", e);
    }
  }
View Full Code Here

      return shouldContinue(
          root, "/api/query-continue/watchlistraw",
          properties);
    } catch (JDOMException e) {
      log.error("Error loading watch list", e);
      throw new APIException("Error parsing XML", e);
    }
  }
View Full Code Here

          throws APIException {
    try {
      getRoot(properties, 1);
    } catch (JDOMParseException e) {
      log.error("Exception in MediaWikiAPI.logout()", e);
      throw new APIException("Couldn't logout");
    }
  }
View Full Code Here

      return shouldContinue(
          root, "/api/query-continue/backlinks",
          properties);
    } catch (JDOMException e) {
      log.error("Error loading back links", e);
      throw new APIException("Error parsing XML", e);
    }
  }
View Full Code Here

      }

      return false;
    } catch (JDOMException e) {
      log.error("Error updating disambiguation status", e);
      throw new APIException("Error parsing XML", e);
    }
  }
View Full Code Here

        getWiki().getConnection().setDeleteToken(currentNode.getAttributeValue("deletetoken"));
        getWiki().getConnection().setEditToken(currentNode.getAttributeValue("edittoken"));
      }
    } catch (JDOMException e) {
      log.error("Error retrieving tokens", e);
      throw new APIException("Error parsing XML", e);
    }
  }
View Full Code Here

      return shouldContinue(
          root, "/api/query-continue/embeddedin",
          properties);
    } catch (JDOMException e) {
      log.error("Error loading embedded in list", e);
      throw new APIException("Error parsing XML", e);
    }
  }
View Full Code Here

TOP

Related Classes of org.wikipediacleaner.api.APIException

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.