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

Non-HTTP based UpdateCenter URLs cause exception in plugin manager

XMLWordPrintable

    • 2.383

      If you use a non http based update center (e.g. file:// or other) then the UpdateCenter validation breaks.

      ```
      2022-12-09 09:31:50.119+0000 [id=107] WARNING o.e.j.s.h.ContextHandler$Context#log: Error while serving http://localhost:8080/manage/pluginManager/checkUpdateSiteUrl
      java.lang.ClassCastException: class sun.net.www.protocol.file.FileURLConnection cannot be cast to class java.net.HttpURLConnection (sun.net.www.protocol.file.FileURLConnection and java.net.HttpURLConnection are in module java.base of loader 'bootstrap')
      at hudson.PluginManager.doCheckUpdateSiteUrl(PluginManager.java:1968)
      at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:710)
      at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:397)
      Caused: java.lang.reflect.InvocationTargetException
      ```

      The UpdateCenter check should not assume all UC are HTTP based.

      Steps to reproduce

      1. download a valid update-center.json file and store it locally on the file system (/tmp/foo.json)
      2. start Jenkins
      3. goto the plugin manager
      4. in the Update Site URL enter a URL such as file:/tmp/foo.json

      Expected results

      Validation passes

      Actual results

      Stack trasce and angry Jenkins

      Caused by https://github.com/jenkinsci/jenkins/pull/6886

            teilo James Nord
            teilo James Nord
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: