0

This is the error my app throws:

Caused by: java.lang.NullPointerException
    at org.docx4j.convert.out.fo.renderers.FORendererApacheFOP.render(FORendererApacheFOP.java:199)
    at org.docx4j.convert.out.fo.renderers.FORendererApacheFOP.render(FORendererApacheFOP.java:159)
    at org.docx4j.convert.out.fo.AbstractFOExporter.postprocess(AbstractFOExporter.java:168)
    at org.docx4j.convert.out.fo.AbstractFOExporter.postprocess(AbstractFOExporter.java:47)
    at org.docx4j.convert.out.common.AbstractExporter.export(AbstractExporter.java:82)
    ... 63 more

Code:

InputStream is = ByteSource.wrap(bytes).openStream();
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(is);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
FOSettings foSettings = Docx4J.createFOSettings();
foSettings.setWmlPackage(wordMLPackage);
Docx4J.toFO(foSettings, baos, Docx4J.FLAG_EXPORT_PREFER_XSL);

The line which throws NPE is

Docx4J.toFO(foSettings, baos, Docx4J.FLAG_EXPORT_PREFER_XSL);

What could be wrong here?

quarks
  • 33,478
  • 73
  • 290
  • 513
  • Which line in particular is throwing the NPE? – VHS Sep 27 '17 at 16:24
  • @VHS This line "Docx4J.toFO(foSettings, baos, Docx4J.FLAG_EXPORT_PREFER_XSL);" – quarks Sep 28 '17 at 00:06
  • I think I have an answer for you. Please post another question so that I can post an answer. Please do not use the word "Null Pointer Exception" in your question. Otherwise people will simply close your question thinking that it is a duplicate. – VHS Sep 28 '17 at 01:13

0 Answers0