Uploaded image for project: 'LaTeX'
  1. LaTeX
  2. LATEX-153

Cannot use raw macro under some conditions in the content of a document to be exported to LaTeX

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 1.25.2
    • 1.25.1
    • Filter, Syntax
    • None
    • Unknown
    • N/A
    • N/A

    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 
      

      Attachments

        Activity

          People

            vmassol Vincent Massol
            vmassol Vincent Massol
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: