Description
To reproduce:
{{groovy}} import org.xwiki.rendering.converter.Converter import org.xwiki.rendering.renderer.printer.DefaultWikiPrinter; import org.xwiki.rendering.syntax.Syntax; import org.xwiki.rendering.syntax.SyntaxType; import java.io.StringReader; Syntax LATEX_SYNTAX = new Syntax(new SyntaxType("latex+fragment", "LaTeX-Fragment"), "1.0"); String wikiText = "image:Test.LaTeXFragment@testimage.jpg" String latexText = "" if (true) { Converter converter = services.component.getContextComponentManager().getInstance(Converter.class) DefaultWikiPrinter printer = new DefaultWikiPrinter() converter.convert(new StringReader(wikiText), Syntax.XWIKI_2_1, LATEX_SYNTAX, printer); latexText = printer.toString() printer = null converter = null } return """ {{raw syntax="latex/1.0"}} $latexText {{/raw}} """ {{/groovy}}
Leads to an exception:
Cannot invoke "org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.closeArchiveEntry()" because "zipStream" is null class java.lang.NullPointerException: Cannot invoke "org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream.closeArchiveEntry()" because "zipStream" is null at wiki:xwiki//org.xwiki.contrib.latex.internal.output.ZipUtils.store(ZipUtils.java:61) at wiki:xwiki//org.xwiki.contrib.latex.internal.output.DefaultLaTeXResourceConverter.store(DefaultLaTeXResourceConverter.java:163) at wiki:xwiki//org.xwiki.contrib.latex.internal.output.DefaultLaTeXResourceConverter.convertATTACHMENTReference(DefaultLaTeXResourceConverter.java:224) at wiki:xwiki//org.xwiki.contrib.latex.internal.output.DefaultLaTeXResourceConverter.convert(DefaultLaTeXResourceConverter.java:142) at wiki:xwiki//org.xwiki.contrib.latex.internal.output.DefaultLaTeXResourceConverter.convert(DefaultLaTeXResourceConverter.java:130) at