-
Bug
-
Resolution: Unresolved
-
Trivial
-
None
-
OS: Ubuntu
Jenkins Version: 2.176.2 and 2.401.2
Web Browser: Mozilla Firefox
A syntax error when entering the value for SCM polling in the job definition page will correctly display red text below the incorrect entry. For example, if I enter '*****' as the scm polling definition, the 2.401.2 job configuration page reports that is a syntax error with red text below the field when the user exits the edit field. The text says:
You appear to be missing whitespace between * and *.
When that warning is ignored and the page is saved anyway, the incorrect syntax for SCM polling is discarded and a stack trace is written to the Jenkins log. That stack trace includes:
2023-07-02 12:05:18.535+0000 [id=115965] WARNING h.i.i.InstallUncaughtExceptionHandler#handleException: Caught unhandled exception with ID 2e66fea4-be37-442a-8adb-0c53db553306 antlr.ANTLRException: line 1:1: missing WS at '*' at jenkins.util.antlr.JenkinsANTLRErrorListener.syntaxError(JenkinsANTLRErrorListener.java:36) at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:41) at org.antlr.v4.runtime.Parser.notifyErrorListeners(Parser.java:544) at org.antlr.v4.runtime.DefaultErrorStrategy.reportMissingToken(DefaultErrorStrategy.java:409) at org.antlr.v4.runtime.DefaultErrorStrategy.singleTokenInsertion(DefaultErrorStrategy.java:519) at org.antlr.v4.runtime.DefaultErrorStrategy.recoverInline(DefaultErrorStrategy.java:476) at org.antlr.v4.runtime.Parser.match(Parser.java:208) at hudson.scheduler.CrontabParser.startRule(CrontabParser.java:153) at hudson.scheduler.CronTab.set(CronTab.java:139) at hudson.scheduler.CronTab.<init>(CronTab.java:117) at hudson.scheduler.CronTabList.create(CronTabList.java:129) Caused: antlr.ANTLRException: Invalid input: "*****": line 1:1: missing WS at '*' at hudson.scheduler.CronTabList.create(CronTabList.java:131) at hudson.scheduler.CronTabList.create(CronTabList.java:99) at hudson.triggers.Trigger.<init>(Trigger.java:178) at hudson.triggers.SCMTrigger.<init>(SCMTrigger.java:113) 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 org.kohsuke.stapler.RequestImpl.invokeConstructor(RequestImpl.java:602) at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:881) at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:766) Caused: java.lang.IllegalArgumentException: Failed to instantiate class hudson.triggers.SCMTrigger from {"scmpoll_spec":"*****","ignorePostCommitHooks":false} at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:769) at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:549) at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:544) at hudson.model.Descriptor.bindJSON(Descriptor.java:622) at hudson.model.Descriptor.newInstance(Descriptor.java:592) Caused: java.lang.LinkageError: Failed to instantiate class hudson.triggers.SCMTrigger from {"scmpoll_spec":"*****","ignorePostCommitHooks":false}
I think that it would be a better experience for the user if the syntax error were politely notified on save rather than showing the angry Jenkins and placing a stack trace on the Jenkins log.