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

[Mail step] Snippet generator generates invalid code

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: pipeline
    • Labels:
      None
    • Environment:
      org.jenkins-ci.main:jenkins-war:1.609.1
      org.jenkins-ci.plugins.workflow:workflow-aggregator:1.8
    • Similar Issues:

      Description

      The snippet generator generates an invalid syntax: mimeType: '' causes javax.mail.internet.ParseException: Expected MIME type, got instead of defaulting to text/plain.

      mail bcc: '', body: 'ready to deploy my-app?', cc: '', charset: '', from: '', mimeType: '', replyTo: '', subject: 'ready to deploy my-app?', to: 'me@example.com'
      
      javax.mail.internet.ParseException: Expected MIME type, got ;
      	at javax.mail.internet.ContentType.<init>(ContentType.java:95)
      	at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1322)
      	at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1021)
      	at javax.mail.internet.MimeMultipart.updateHeaders(MimeMultipart.java:419)
      	at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1345)
      	at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2106)
      	at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:2074)
      	at javax.mail.Transport.send(Transport.java:123)
      	at org.jenkinsci.plugins.workflow.steps.MailStep$MailStepExecution.run(MailStep.java:113)
      	at org.jenkinsci.plugins.workflow.steps.MailStep$MailStepExecution.run(MailStep.java:100)
      	at org.jenkinsci.plugins.workflow.steps.AbstractSynchronousStepExecution.start(AbstractSynchronousStepExecution.java:34)
      	at org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:136)
      	at org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:98)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:45)
      	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)
      	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:15)
      	at WorkflowScript.run(WorkflowScript:13)
      	at Unknown.Unknown(Unknown)
      	at ___cps.transform___(Native Method)
      	at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:69)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:106)
      	at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:79)
      	at sun.reflect.GeneratedMethodAccessor314.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
      	at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.dispatch(CollectionLiteralBlock.java:55)
      	at com.cloudbees.groovy.cps.impl.CollectionLiteralBlock$ContinuationImpl.item(CollectionLiteralBlock.java:45)
      	at sun.reflect.GeneratedMethodAccessor319.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:497)
      	at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72)
      	at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21)
      	at com.cloudbees.groovy.cps.Next.step(Next.java:58)
      	at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:145)
      	at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:164)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:271)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$000(CpsThreadGroup.java:71)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:180)
      	at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:178)
      	at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:47)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:112)
      	at jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
      	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
      	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
      	at java.lang.Thread.run(Thread.java:745)
      

        Attachments

          Activity

          cleclerc Cyrille Le Clerc created issue -
          jglick Jesse Glick made changes -
          Field Original Value New Value
          Labels workflow
          jglick Jesse Glick made changes -
          Labels workflow
          Hide
          jglick Jesse Glick added a comment -

          Probably failing to default to use Util.fixEmpty.

          Show
          jglick Jesse Glick added a comment - Probably failing to default to use Util.fixEmpty .
          Hide
          linugee hyunil shin added a comment -

          I had the same problems.
          I just change to use emailext, instead of mail.
          It works.

          Show
          linugee hyunil shin added a comment - I had the same problems. I just change to use emailext, instead of mail. It works.
          jglick Jesse Glick made changes -
          Epic Link JENKINS-35393 [ 171186 ]
          Hide
          owood Owen Wood added a comment - - edited

          As a workaround.

          Remove:

          • mimeType = ''
          • charset = ''

          to allow the mailer to use the defaults.

          Example:

          mail bcc: '', body: 'ready to deploy my-app?', cc: '', from: '', replyTo: '', subject: 'ready to deploy my-app?', to: 'me@example.com'
          
          Show
          owood Owen Wood added a comment - - edited As a workaround. Remove: mimeType = '' charset = '' to allow the mailer to use the defaults. Example: mail bcc: '', body: ' ready to deploy my-app? ', cc: ' ', from: ' ', replyTo: ' ', subject: ' ready to deploy my-app? ', to: ' me@example.com'
          owood Owen Wood made changes -
          Status Open [ 1 ] Closed [ 6 ]
          Resolution Not A Defect [ 7 ]
          owood Owen Wood made changes -
          Resolution Not A Defect [ 7 ]
          Status Closed [ 6 ] Reopened [ 4 ]
          owood Owen Wood made changes -
          Comment [ Not a defect IMO ]
          owood Owen Wood made changes -
          Comment [ Re-opening as this is an issue with the snippet generator, not the plugin. My bad ]
          owood Owen Wood made changes -
          Assignee Jesse Glick [ jglick ] Owen Wood [ owood ]
          Show
          owood Owen Wood added a comment - https://github.com/jenkinsci/workflow-basic-steps-plugin/pull/12
          jglick Jesse Glick made changes -
          Status Reopened [ 4 ] Open [ 1 ]
          jglick Jesse Glick made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          jglick Jesse Glick made changes -
          Status In Progress [ 3 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 164038 ] JNJira + In-Review [ 197394 ]
          abayer Andrew Bayer made changes -
          Component/s pipeline-general [ 21692 ]
          abayer Andrew Bayer made changes -
          Component/s workflow-plugin [ 18820 ]

            People

            • Assignee:
              owood Owen Wood
              Reporter:
              cleclerc Cyrille Le Clerc
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: