Incomplete XSL transformation if using ErrorListener, ONLY on Jenkins

一个人想着一个人 提交于 2020-06-29 03:58:26

问题


I am trying to have an XSL transformation to run on a Jenkins pipeline.

I need to catch XSL transformation's xsl:message. In order to achieve so, I added an ErrorListener:

final ErrorListener errorListener = new ErrorListener() {

  final public List<TransformerException> errorList = new LinkedList<>()

  @Override
  void warning(final TransformerException e) throws TransformerException {
    errorList.add(e)
  }

  @Override
  void error(final TransformerException e) throws TransformerException {
    errorList.add(e)
  }

  @Override
  void fatalError(final TransformerException e) throws TransformerException {
    errorList.add(e)
   }
}

transformer.setErrorListener(errorListener)
transformer.transform(streamSource, streamResult)

This perfectly works if I run it locally. The transformation gracefully ends and I fetch all desired xsl:message (via the ErrorListener's warning method being invoked).

However, if I run this on a Jenkins machine, only the first xsl:message is raised (via the ErrorListener's warning method being invoked) and the transformation does not continue. This leads to an half filled resulting (html) file.

If I remove the ErrorListener, the transformation ends gracefully and I get a filled resulting (html) file, but I obviously don't fetch the xsl:message.

Do you guys have any idea of what the problem could be ?

来源:https://stackoverflow.com/questions/62346635/incomplete-xsl-transformation-if-using-errorlistener-only-on-jenkins

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!