我试着从jenkins管道调用这个,结果出现了一个错误
def setAppBuildDate(buildDate) {
outputDateFormat = "dd-MMM-yyyy z"
dateTxt = ''
try {
sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'")
dateTxt = sdf.parse(buildDate)
} catch (java.text.ParseException pe) {
sdf = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy")
dateTxt = sdf.parse(buildDate)
}
dateTxt = sdf.parse(buildDate)
APP_BUILD_DATE = dateTxt.format(outputDateFormat, TZ_GMT)
}
我得到的错误是
java.text.ParseException: Unparseable date: ""
at java.text.DateFormat.parse(DateFormat.java:366)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
at org.codehaus.groovy.runtime.callsite.PojoMetaClassSite.call(PojoMetaClassSite.java:47)
你能帮个忙吗
暂无答案!
目前还没有任何答案,快来回答吧!