languagetool-org/languagetool · error · RuntimeException

Timeout accessing + wikipediaUrl

Error message

Timeout accessing + wikipediaUrl

What it means

Network guard in WikipediaQuickCheck.getContent: the HTTP connection to the Wikipedia URL timed out (30s connect/read limit), so the page content could never be fetched.

Source

Thrown at languagetool-wikipedia/src/main/java/org/languagetool/dev/wikipedia/WikipediaQuickCheck.java:276

    for (Rule rule : allActiveRules) {
      if (rule.isDictionaryBasedSpellingRule()) {
        languageTool.disableRule(rule.getId());
      }
    }
  }

  private String getContent(URL wikipediaUrl) throws IOException {
    try {
      HttpURLConnection conn = (HttpURLConnection) wikipediaUrl.openConnection();
      conn.setRequestMethod("GET");
      conn.setConnectTimeout(30_000);
      conn.setReadTimeout(30_000);
      conn.connect();
      try (InputStream contentStream = (InputStream) conn.getContent()) {
        return StringTools.streamToString(contentStream, "UTF-8");
      }
    } catch (SocketTimeoutException e) {
      throw new RuntimeException("Timeout accessing " + wikipediaUrl, e);
    }
  }

  /*public static void mainTest(String[] args) throws IOException {
      TextFilter filter = new SwebleWikipediaTextFilter();
      String plainText = filter.filter("hallo\n* eins\n* zwei");
      System.out.println(plainText);
  }*/
    
  public static void main(String[] args) throws IOException, PageNotFoundException {
    if (args.length != 1) {
      System.out.println("Usage: " + WikipediaQuickCheck.class.getName() + " <url>");
      System.exit(1);
    }
    WikipediaQuickCheck check = new WikipediaQuickCheck();
    // URL examples:
    //String urlString = "http://de.wikipedia.org/wiki/Angela_Merkel";
    //String urlString = "https://de.wikipedia.org/wiki/Benutzer_Diskussion:Dnaber";

View on GitHub (pinned to 2e990059ce)

Solutions

  1. Retry the request; Wikipedia throttling is often transient
  2. Increase the connect/read timeouts
  3. Add caching or rate limiting to avoid repeated heavy fetches
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at languagetool-wikipedia/src/main/java/org/languagetool/dev/wikipedia/WikipediaQuickCheck.java:276 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06). Data as JSON: /api/errors/8f6a2c94270cad4f. Report an issue: GitHub.