Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-71391

Ugly form validation for sidebar link of folder

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • sidebar-link-plugin
    • None
    • Sidebar Link plugin 2.2.2
      Folders plugin 6.815.v0dd5a_cb_40e0e
      Jenkins 2.401.1

      To reproduce

      Create a job with type Folder and name "linktest".
      In the configuration of the folder, expand "Sidebar Links", click "Add Link", and enter the following information:

      Click "Apply".

      Expected results

      An error message below the "Link URL" field explains that the "file" scheme is not allowed.

      Note: This works correctly on the "System" configuration page (/manage/configure), but not in folder configuration.

      Actual results

      A message pops up:

      Error

      A problem occurred while processing the request.

      Logging ID=6f1a8ac1-509b-423a-8388-cf1fb89b7b64

      and the Jenkins log shows the stack trace of the error:

      kesäk. 02, 2023 4:44:31 IP. WARNING hudson.init.impl.InstallUncaughtExceptionHandler handleException
      
      Caught unhandled exception with ID 6f1a8ac1-509b-423a-8388-cf1fb89b7b64
      ERROR: URI scheme "file" is not allowed. Allowed schemes: news,ftps,ftp,rtsp,svn,xmpp,nntp,feed,mms,telnet,http,mailto,tel,https,irc,fax,gopher
      	at hudson.util.FormValidation._errorWithMarkup(FormValidation.java:273)
      	at hudson.util.FormValidation.errorWithMarkup(FormValidation.java:259)
      	at hudson.util.FormValidation.error(FormValidation.java:150)
      	at hudson.plugins.sidebar_link.LinkProtection.verifyUrl(LinkProtection.java:94)
      	at hudson.plugins.sidebar_link.LinkAction.<init>(LinkAction.java:64)
      Caused: java.lang.IllegalArgumentException
      	at hudson.plugins.sidebar_link.LinkAction.<init>(LinkAction.java:66)
      	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.plugins.sidebar_link.LinkAction from {"urlName":"file://localhost/","displayName":"Local Files","iconFileName":"folder"}
      	at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:769)
      	at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:805)
      	at org.kohsuke.stapler.RequestImpl.bindJSON(RequestImpl.java:549)
      	at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:875)
      Caused: java.lang.IllegalArgumentException: Failed to convert the links parameter of the constructor public hudson.plugins.sidebar_link.FolderLinks(java.util.List)
      	at org.kohsuke.stapler.RequestImpl.instantiate(RequestImpl.java:877)
      	at org.kohsuke.stapler.RequestImpl$TypePair.convertJSON(RequestImpl.java:766)
      Caused: java.lang.IllegalArgumentException: Failed to instantiate class hudson.plugins.sidebar_link.FolderLinks from {"links":{"urlName":"file://localhost/","displayName":"Local Files","iconFileName":"folder"}}
      	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.plugins.sidebar_link.FolderLinks from {"links":{"urlName":"file://localhost/","displayName":"Local Files","iconFileName":"folder"}}
      	at hudson.model.Descriptor.newInstance(Descriptor.java:595)
      	at com.cloudbees.hudson.plugins.folder.AbstractFolderPropertyDescriptor.newInstance(AbstractFolderPropertyDescriptor.java:55)
      	at com.cloudbees.hudson.plugins.folder.FolderPropertyDescriptor.newInstance(FolderPropertyDescriptor.java:40)
      	at com.cloudbees.hudson.plugins.folder.FolderPropertyDescriptor.newInstance(FolderPropertyDescriptor.java:36)
      	at hudson.util.DescribableList.rebuild(DescribableList.java:179)
      	at com.cloudbees.hudson.plugins.folder.AbstractFolder.doConfigSubmit(AbstractFolder.java:1354)
      	at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:710)
      	at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:397)
      	at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:409)
      	at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:78)
      	at org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26)
      	at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:207)
      	at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:140)
      	at org.kohsuke.stapler.MetaClass$11.doDispatch(MetaClass.java:558)
      	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:59)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:770)
      Caused: javax.servlet.ServletException
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:818)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900)
      	at org.kohsuke.stapler.MetaClass$4.doDispatch(MetaClass.java:289)
      	at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:59)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:770)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:698)
      	at org.kohsuke.stapler.Stapler.service(Stapler.java:248)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
      

      (I omit the rest of the stack trace because it seems uninteresting.)

            dszczepanik Damian Szczepanik
            kon Kalle Niemitalo
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: