{"record":{"id":"72f32eafabfb7f05","repo":"languagetool-org/languagetool","slug":"could-not-handle-url-click-url","errorCode":null,"errorMessage":"Could not handle URL click: ${url}","messagePattern":"Could not handle URL click: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"languagetool-standalone/src/main/java/org/languagetool/gui/ResultAreaHelper.java","lineNumber":327,"sourceCode":"        filtered.add(ruleMatch);\n      }\n    }\n    return filtered;\n  }\n\n  @Override\n  public void hyperlinkUpdate(HyperlinkEvent e) {\n    if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {\n      URL url = e.getURL();\n      try {\n        String uri = url.toURI().toString();\n        if (uri.startsWith(DEACTIVATE_URL) || uri.startsWith(REACTIVATE_URL)) {\n          handleRuleLinkClick(uri);\n        } else {\n          Tools.openURL(url);\n        }\n      } catch (Exception ex) {\n        throw new RuntimeException(\"Could not handle URL click: \" + url, ex);\n      }\n    }\n  }\n\n  private void handleRuleLinkClick(String uri) throws IOException {\n    RuleLink ruleLink = RuleLink.getFromString(uri);\n    String ruleId = ruleLink.getId();\n    if (uri.startsWith(DEACTIVATE_URL)) {\n      ltSupport.disableRule(ruleId);\n    } else {\n      ltSupport.enableRule(ruleId);\n    }\n    ltSupport.getConfig().saveConfiguration(ltSupport.getLanguage());\n    ltSupport.checkImmediately(this);\n  }\n\n}\n","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-standalone/src/main/java/org/languagetool/gui/ResultAreaHelper.java#L309-L345","documentation":"In the LanguageTool standalone GUI, clicking a hyperlink in results opens the URL via Tools.openURL(); if any exception occurs (malformed URI, no browser/desktop available, OS failure), hyperlinkUpdate wraps it in a RuntimeException with this message. The original cause is attached as the exception cause.","triggerScenarios":"Clicking an external link (e.g. rule documentation URL) in the GUI results pane when the URI is invalid or the platform cannot launch a browser; handleRuleLinkClick failing to parse a rule link URI.","commonSituations":"Running standalone on a headless system without a default browser; corrupted rule-link strings; URI syntax problems in custom rule descriptions.","solutions":["Inspect the exception cause to see why openURL failed","Set/repair the default browser or Desktop.browse() support on the OS","Copy the URL manually into a browser if the GUI cannot open it","Check that the clicked rule link URI is well-formed; report a bug if it comes from built-in rules"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { Tools.openURL(url); } catch (Exception ex) { log.warn(\"Could not open URL: \" + url, ex); JOptionPane.showMessageDialog(parent, \"Please open manually: \" + url); }","preventionTips":["Run the GUI on a system with a default browser configured","Validate URIs in custom rule descriptions","Catch and log around link handling so one bad link doesn't break the UI"],"tags":["gui","swing","url","desktop-integration"],"backgroundTag":"invalid-url","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"}