Back to LanguageTool Homepage - Privacy - Imprint

[en] exception when checking a sentence in English

I just checked out the latest LanguageTool from git (SHA1: fd4f458e3d78978fbf3bc38ccc0518d927b1d71e i.e. Jan 6, 2022) it I see a bug when checking this sentence in English:

$ echo "For example, you will be able to see exactly which functions are called, how much time they require, and how they interact with each other in a multi-threaded environment." | java -jar languagetool/languagetool-standalone/target/LanguageTool-5.7-SNAPSHOT/LanguageTool-5.7-SNAPSHOT/languagetool-commandline.jar -c utf-8 -l en
Expected text language: English (no spell checking active, specify a language variant like 'en-GB' if available)
Working on STDIN...
Exception in thread "main" java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.RuntimeException: Could not check sentence (language: English): <sentcontent>For example, you will be able to see exactly which functions are called, how much time they require, and how they interact with each other in a multi-threaded environment.
</sentcontent>
        at org.languagetool.MultiThreadedJLanguageTool.performCheck(MultiThreadedJLanguageTool.java:217)
        at org.languagetool.JLanguageTool.checkInternal(JLanguageTool.java:1002)
        at org.languagetool.JLanguageTool.check(JLanguageTool.java:929)
        at org.languagetool.JLanguageTool.check(JLanguageTool.java:914)
        at org.languagetool.commandline.CommandLineTools.checkText(CommandLineTools.java:108)
        at org.languagetool.commandline.CommandLineTools.checkText(CommandLineTools.java:84)
        at org.languagetool.commandline.Main.runOnFile(Main.java:192)
        at org.languagetool.commandline.Main.main(Main.java:464)
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: java.lang.RuntimeException: Could not check sentence (language: English): <sentcontent>For example, you will be able to see exactly which functions are called, how much time they require, and how they interact with each other in a multi-threaded environment.
</sentcontent>
        at java.base/java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1006)
        at org.languagetool.MultiThreadedJLanguageTool.performCheck(MultiThreadedJLanguageTool.java:214)
        ... 7 more
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Could not check sentence (language: English): <sentcontent>For example, you will be able to see exactly which functions are called, how much time they require, and how they interact with each other in a multi-threaded environment.
</sentcontent>
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at java.base/java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:600)
        ... 9 more
Caused by: java.lang.RuntimeException: Could not check sentence (language: English): <sentcontent>For example, you will be able to see exactly which functions are called, how much time they require, and how they interact with each other in a multi-threaded environment.
</sentcontent>
        at org.languagetool.JLanguageTool$TextCheckCallable.getOtherRuleMatches(JLanguageTool.java:2032)
        at org.languagetool.JLanguageTool$TextCheckCallable.call(JLanguageTool.java:1907)
        at org.languagetool.MultiThreadedJLanguageTool.lambda$performCheck$1(MultiThreadedJLanguageTool.java:200)
        at java.base/java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1448)
        at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
        at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
        at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
        at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
        at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: java.lang.NullPointerException
        at org.languagetool.rules.en.CompoundRule.isMisspelled(CompoundRule.java:162)
        at org.languagetool.rules.AbstractCompoundRule.isCorrectSpell(AbstractCompoundRule.java:255)
        at org.languagetool.rules.AbstractCompoundRule.filterReplacements(AbstractCompoundRule.java:176)
        at org.languagetool.rules.AbstractCompoundRule.match(AbstractCompoundRule.java:150)
        at org.languagetool.JLanguageTool.checkAnalyzedSentence(JLanguageTool.java:1415)
        at org.languagetool.JLanguageTool.access$1500(JLanguageTool.java:77)
        at org.languagetool.JLanguageTool$TextCheckCallable.getOtherRuleMatches(JLanguageTool.java:1992)
        ... 8 more

Thank you. The problem is that a spelling rule is used for testing compounds, and with language code “en” (with no language variant) the rule is undefined. American English will be used by default. https://github.com/languagetool-org/languagetool/commit/ef3e158f0791d73c5a8a6474fcf425cc3cf9a3a2