{"record":{"id":"e8d25015e1982d1b","repo":"languagetool-org/languagetool","slug":"throw-new-runtimeexception-e-e8d250","errorCode":null,"errorMessage":"throw new RuntimeException(e)","messagePattern":"throw new RuntimeException\\(e\\)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"languagetool-language-modules/en/src/main/java/org/languagetool/rules/en/translation/Inflector.java","lineNumber":89,"sourceCode":"    } else if (dePosTag.matches(\"PA2:PRD:GRU:VER\")) {\n      forms.addAll(getForms(enToken, \"VBN\"));\n    } else if (dePosTag.matches(\"ADJ:PRD:KOM|ADJ:.*:KOM.*\")) {\n      forms.addAll(getForms(enToken, \"JJR\"));\n    } else if (dePosTag.matches(\"ADJ:.*:SUP.*\")) {\n      forms.addAll(getForms(enToken, \"JJS\"));\n    } else {\n      forms.add(enToken);\n    }\n    return forms;\n  }\n\n  @SuppressWarnings(\"ConstantConditions\")\n  @NotNull\n  private List<String> getForms(String enToken, String posTagRegex) {\n    try {\n      return Arrays.asList(enSynth.synthesize(new AnalyzedToken(enToken, \"fake-value\", enToken), posTagRegex, true));\n    } catch (IOException e) {\n      throw new RuntimeException(e);\n    }\n  }\n}\n","sourceCodeStart":71,"sourceCodeEnd":93,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-language-modules/en/src/main/java/org/languagetool/rules/en/translation/Inflector.java#L71-L93","documentation":"Inflector.getForms synthesizes word forms via the English synthesizer (enSynth.synthesize), which declares IOException. Since getForms cannot throw a checked exception, any IOException from the synthesizer is rethrown as an unchecked RuntimeException with the original exception as cause.","triggerScenarios":"Calling getForms (directly or through inflectSingleWord) when enSynth.synthesize throws IOException — typically the synthesis dictionary resource is missing or unreadable.","commonSituations":"Running inflection utilities outside a fully assembled LanguageTool distribution where the English synthesizer data is absent; corrupt resource files; classpath issues in tests or embedded usage.","solutions":["Inspect the cause RuntimeException to find the underlying IOException and missing resource.","Ensure the English synthesizer dictionary (part of the en language module) is on the classpath.","Wrap calls in try-catch at a higher level if inflection is optional for the workflow."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (enToken == null || enToken.isBlank() || posTagRegex == null) return Collections.emptyList();","typeGuard":null,"tryCatchPattern":"try {\n  List<String> forms = inflector.inflectSingleWord(word, posRegex);\n} catch (RuntimeException e) {\n  if (e.getCause() instanceof IOException io) { /* degrade gracefully or load synthesizer data */ }\n}","preventionTips":["Verify English synthesizer data files are present before inflection","Run inflection in an environment with the full LanguageTool distribution","Treat inflection as optional and provide fallbacks for single-token failures"],"tags":["languagetool","inflection","io","synthesizer"],"backgroundTag":"file-read-failed","analyzedSha":"2e990059ce67d5e2a0f7f7ca5d31160c6709df4b","analyzedAt":"2026-09-06T09:20:17.015Z","contentChangedAt":"2026-09-06T09:20:17.015Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}