使用emailext插件时的java.lang.StackOverflowError

时间:2017-02-23 06:56:50

标签: jenkins jenkins-plugins email-ext

在我的管道的最后,我想发送一个邮件,看看我的构建是否成功。因此我使用以下groovy脚本:

emailext (
to: 'mail@example.com',
subject: 'Job: ' + env.JOB_NAME + ' / ' +'Build #' + env.BUILD_NUMBER + ' / ' + ' Summary',
body:'Integrity Checkout: '+ '\t\t\t' + checkoutStatus +'\n\n' + 'Build1: '+ '\t\t\t' + Build1 + '\n' 
                                                       + 'Build2 :'+ '\t' + Build2 + '\n'
                                                       + 'Build3 :'+ '\t' + Build3 + '\n'
                                                       + 'Build4 :'+ '\t' + Build4 + '\n'
                                                       + 'Build5 :'+ '\t' + Build5 + '\n'
                                                       + 'Build6 :'+ '\t' + Build6 + '\n'
                                                       + 'Build7 :'+ '\t' + Build7 + '\n'
                                                       + 'Build8 :'+ '\t' + Build8 + '\n'
                                                       + 'Build9 :'+ '\t' + Build9 + '\n'
                                                       + 'Build10:'+ '\t' + Build10 + '\n'
                                                       + 'Build11:'+ '\t' + Build11 + '\n'
                                                       + 'Build12:'+ '\t' + Build12 + '\n'
                                                       + 'Build13:'+ '\t' + Build13 + '\n'
                                                       + 'Build14:'+ '\t' + Build14 + '\n'
                                                       + 'Build15:'+ '\t' + Build15 + '\n'
                                                       + 'Build16:'+ '\t' + Build16,
attachLog: true,
compressLog: true
)

基本上代码工作正常,但只有当我注释掉最后一行(build16)时。变量已正确分配。但是如果我执行代码,我会得到一个java.lang.StackOverflowError。 (超过1000行)

简短的剪辑:

java.lang.StackOverflowError
at java.lang.Exception.<init>(Unknown Source)
at java.lang.ReflectiveOperationException.<init>(Unknown Source)
at java.lang.reflect.InvocationTargetException.<init>(Unknown Source)
at sun.reflect.GeneratedMethodAccessor4094.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
at com.cloudbees.groovy.cps.CpsTransformer$_visitBinaryExpression_closure26.doCall(CpsTransformer.groovy)
at sun.reflect.GeneratedMethodAccessor4092.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
at com.cloudbees.groovy.cps.CpsTransformer.makeChildren(CpsTransformer.groovy:355)
at sun.reflect.GeneratedMethodAccessor3945.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
at com.cloudbees.groovy.cps.CpsTransformer.makeNode(CpsTransformer.groovy:330)
at sun.reflect.GeneratedMethodAccessor3944.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:174)
at com.cloudbees.groovy.cps.CpsTransformer.visitBinaryExpression(CpsTransformer.groovy:636)
at org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)
at org.codehaus.groovy.ast.expr.BinaryExpression$visit.call(Unknown Source)
at com.cloudbees.groovy.cps.CpsTransformer.visit(CpsTransformer.groovy:290)
at sun.reflect.GeneratedMethodAccessor3946.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:384)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
at com.cloudbees.groovy.cps.CpsTransformer$_visitBinaryExpression_closure26.doCall(CpsTransformer.groovy:630)
at sun.reflect.GeneratedMethodAccessor4094.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.callCurrent(PogoMetaClassSite.java:69)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
at com.cloudbees.groovy.cps.CpsTransformer$_visitBinaryExpression_closure26.doCall(CpsTransformer.groovy)
at sun.reflect.GeneratedMethodAccessor4092.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1024)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
at com.cloudbees.groovy.cps.CpsTransformer.makeChildren(CpsTransformer.groovy:355)
at sun.reflect.GeneratedMethodAccessor3945.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:166)
at com.cloudbees.groovy.cps.CpsTransformer.makeNode(CpsTransformer.groovy:330)
at sun.reflect.GeneratedMethodAccessor3944.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:174)
at com.cloudbees.groovy.cps.CpsTransformer.visitBinaryExpression(CpsTransformer.groovy:636)
at org.codehaus.groovy.ast.expr.BinaryExpression.visit(BinaryExpression.java:51)
at org.codehaus.groovy.ast.expr.BinaryExpression$visit.call(Unknown Source)
at com.cloudbees.groovy.cps.CpsTransformer.visit(CpsTransformer.groovy:290)
at sun.reflect.GeneratedMethodAccessor3946.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)

1 个答案:

答案 0 :(得分:0)

解决了这个问题。大量的“+”运算符导致了溢出。现在我使用java.lang.StringBuilder.append来构建输出字符串。