{"record":{"id":"05fade472fb9c805","repo":"languagetool-org/languagetool","slug":"throw-new-runtimeexception-e-05fade","errorCode":null,"errorMessage":"throw new RuntimeException(e)","messagePattern":"throw new RuntimeException\\(e\\)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"languagetool-language-modules/es/src/main/java/org/languagetool/language/Spanish.java","lineNumber":377,"sourceCode":"        if (ruleMatch.getRule().getId().equals(\"AI_ES_GGEC_MISSING_PUNCTUATION\") && suggestion.endsWith(\".\")) {\n          if (ruleMatch.getSentence().getText().replaceAll(\"\\\\s+$\", \"\").endsWith(suggestion.substring(0,suggestion.length()-1))) {\n            continue;\n          }\n        }\n        // avoid obsolete diacritics\n        if (suggestionsToAvoid.contains(suggestion.toLowerCase())) {\n          continue;\n        }\n        // avoid lowercase at the sentence start\n        if (ruleMatch.getSentence().getText().trim().startsWith(StringTools.uppercaseFirstChar(suggestion))) {\n          continue;\n        }\n        // avoid voseo forms in suggestions\n        List<AnalyzedTokenReadings> atr;\n        try {\n          atr = this.getTagger().tag(Collections.singletonList(suggestion));\n        } catch (IOException e) {\n          throw new RuntimeException(e);\n        }\n        if (atr != null && atr.size()>0) {\n          if (atr.get(0).matchesPosTagRegex(voseoPostagPatern)) {\n            continue;\n          }\n        }\n        ruleMatch.setOriginalErrorStr();\n        // the suggestion only changes the casing\n        if (suggestion.equalsIgnoreCase(ruleMatch.getOriginalErrorStr())) {\n          ruleMatch.setMessage(\"Mayúsculas y minúsculas recomendadas.\");\n          ruleMatch.setShortMessage(\"Mayúsculas y minúsculas\");\n          ruleMatch.getRule().setLocQualityIssueType(ITSIssueType.Typographical);\n          ruleMatch.getRule().setCategory(Categories.CASING.getCategory(ResourceBundleTools.getMessageBundle(this)));\n          ruleMatch.setSpecificRuleId(ruleMatch.getRule().getId().replace(\"ORTHOGRAPHY\", \"CASING\"));\n          //ruleMatch.getRule().setTags(Arrays.asList(Tag.picky));\n        }\n      }\n      results.add(ruleMatch);","sourceCodeStart":359,"sourceCodeEnd":395,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-language-modules/es/src/main/java/org/languagetool/language/Spanish.java#L359-L395","documentation":"Spanish.filterRuleMatches filters out voseo forms from rule-match suggestions. For each suggestion it re-tags the word with the Spanish tagger; since tag() declares IOException and the filter cannot propagate checked exceptions, the IOException is wrapped in an unchecked RuntimeException.","triggerScenarios":"Applying this filter (via filterRuleMatches) when the Spanish tagger's tag() call fails with IOException — typically missing or unreadable Spanish tagging dictionary resources for a suggestion word.","commonSituations":"Running with an incomplete language module build; resource loading failures in packaged deployments; corrupted Spanish dictionary data.","solutions":["Inspect the wrapped IOException cause to identify the failing tagger resource.","Repair/rebuild the Spanish language module so tagger dictionaries are available on the classpath.","Check disk/IO health if the failure is transient rather than a missing resource."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if (suggestion == null || suggestion.isBlank()) continue;","typeGuard":null,"tryCatchPattern":"try {\n  matches = spanish.filterRuleMatches(matches, sentence);\n} catch (RuntimeException e) {\n  if (e.getCause() instanceof IOException io) { /* log and continue with unfiltered matches */ }\n}","preventionTips":["Deploy with the complete Spanish language module including tagger data","Monitor for IOException causes pointing at missing resources","Validate the installation by tagging a sample word at startup"],"tags":["languagetool","spanish","tagging","io"],"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"}