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

ClassCastException in SonarUtils getPersistentActions

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      Issue:
      When iterating over all the actions within a Jenkins job using this code I hit a ClassCastException because getActions() does not necessarily return a class that can be converted to Action. This happened in particular with hudson.model.ParametersDefinitionProperty when I had a parameter in my build process. This issue is easily reproducible with the attached build.xml

      Steps to Reproduce:
      1. Open up the Sonar plugin code in IDE of your choice
      2. Do a mvn hpi:run and create a freestyle job
      3. Build said freestyle job 2 times
      4. Stop the run and then modify build #2's build.xml file with the attached
      5. Restart the hpi:run
      6. Observe the class cast error in the logs and the build #2 not show in the UI

      Expected results:
      The build.xml would throw other errors(like the sonar not existing) but be able to parse the build.xml

      Other Notes:
      I would normally expect the return for getActions() to be actionable items but apparently since it is deprecated the process has changed for what that will return. Additionally the getAllActions() method can not be used since it calls the overwritten createFor() which ends up causing a stackoverflow. There needs to either be a better checking on the getActions or the getActions needs to be replaced and the createFor() method needs to be fixed

        Attachments

          Activity

          There are no comments yet on this issue.

            People

            Assignee:
            sonarteam Sonar Team
            Reporter:
            ataylor Alex Taylor
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: