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

Email Template Testing should support managed files as well

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: email-ext-plugin
    • Labels:
      None
    • Environment:
      Jenkins 1.565
      Email-Ext 2.38.1
    • Similar Issues:

      Description

      When adding an Email-Ext post-build action, managed file templates can be used by pre-pending "managed:" when calling the script.

      Unfortunately the same is not true when using the Template Testing page.

      When trying to test a managed template the following exception is seen:

      <pre>
      Caused by: java.lang.UnsupportedOperationException
      at java.util.AbstractList.add(AbstractList.java:148)
      at java.util.AbstractList.add(AbstractList.java:108)
      at hudson.plugins.emailext.EmailExtTemplateAction.getTemplateConfigProviders(EmailExtTemplateAction.java:94)
      at hudson.plugins.emailext.EmailExtTemplateAction.checkForManagedFile(EmailExtTemplateAction.java:75)
      at hudson.plugins.emailext.EmailExtTemplateAction.doTemplateFileCheck(EmailExtTemplateAction.java:59)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.lang.reflect.Method.invoke(Method.java:606)
      at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:298)
      at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:161)
      at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:96)
      at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:120)
      at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:53)
      at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:728)
      ... 70 more

      </pre>

        Attachments

          Activity

          Hide
          alex_ouzounis Alex Ouzounis added a comment -

          The problem seems to be line 90 where the list is defined as:

          Collection<ConfigProvider> providers = Collections.emptyList();

          which is immutable as noted by its associated Javadoc. Replacing this with a new list should do the trick.

          Alex

          Show
          alex_ouzounis Alex Ouzounis added a comment - The problem seems to be line 90 where the list is defined as: Collection<ConfigProvider> providers = Collections.emptyList(); which is immutable as noted by its associated Javadoc. Replacing this with a new list should do the trick. Alex
          Hide
          alex_ouzounis Alex Ouzounis added a comment -
          Show
          alex_ouzounis Alex Ouzounis added a comment - created pull request: https://github.com/jenkinsci/email-ext-plugin/pull/92
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Alex Ouzounis
          Path:
          src/main/java/hudson/plugins/emailext/EmailExtTemplateAction.java
          http://jenkins-ci.org/commit/email-ext-plugin/f547850db6ae70f09184686a35633a705c66efbb
          Log:
          JENKINS-23619

          updated getTemplateConfigProviders to create a new List instead of using an immutable empty list from Collections.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Alex Ouzounis Path: src/main/java/hudson/plugins/emailext/EmailExtTemplateAction.java http://jenkins-ci.org/commit/email-ext-plugin/f547850db6ae70f09184686a35633a705c66efbb Log: JENKINS-23619 updated getTemplateConfigProviders to create a new List instead of using an immutable empty list from Collections.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Alex Ouzounis
          Path:
          src/main/java/hudson/plugins/emailext/EmailExtTemplateAction.java
          http://jenkins-ci.org/commit/email-ext-plugin/a596998bf48dcafe95085b59a3e93d9c3dc92d9d
          Log:
          JENKINS-23619

          added missing import statement

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Alex Ouzounis Path: src/main/java/hudson/plugins/emailext/EmailExtTemplateAction.java http://jenkins-ci.org/commit/email-ext-plugin/a596998bf48dcafe95085b59a3e93d9c3dc92d9d Log: JENKINS-23619 added missing import statement
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: Alex Earl
          Path:
          src/main/java/hudson/plugins/emailext/EmailExtTemplateAction.java
          http://jenkins-ci.org/commit/email-ext-plugin/684ab899efcd82ca8e41d1655ee4ef118bdecb1d
          Log:
          Merge pull request #92 from alexouzounis/master

          JENKINS-23619

          Compare: https://github.com/jenkinsci/email-ext-plugin/compare/dab0e4849bf4...684ab899efcd

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Alex Earl Path: src/main/java/hudson/plugins/emailext/EmailExtTemplateAction.java http://jenkins-ci.org/commit/email-ext-plugin/684ab899efcd82ca8e41d1655ee4ef118bdecb1d Log: Merge pull request #92 from alexouzounis/master JENKINS-23619 Compare: https://github.com/jenkinsci/email-ext-plugin/compare/dab0e4849bf4...684ab899efcd
          Hide
          slide_o_mix Alex Earl added a comment -

          Fixed via pull request

          Show
          slide_o_mix Alex Earl added a comment - Fixed via pull request

            People

            • Assignee:
              slide_o_mix Alex Earl
              Reporter:
              alex_ouzounis Alex Ouzounis
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: