Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Bug
-
2.9
-
None
-
None
Description
hi,
we are relying on the fop to generate PDF given data held in database + file storage.
we need to represent some ( file.name, file.data) as a pdf embedded attachment.
some users have encountered issue when the file.name value carries hash sign ('#')
upon generating the pdf, an exception is thrown about missing attachment name.
I have added a new test to the PDFAttachmentTestCase class (see attachment) to reproduce the issue.
The added test that generates the error is:
@Test
public void testAddEmbeddedFileDash () throws IFException
running the command:
mvn test -pl fop-core -Dtest=PDFAttachmentTestCase
I get the following output:
Running org.apache.fop.pdf.PDFAttachmentTestCase
Tests run: 4, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.15 sec <<< FAILURE! - in org.apache.fop.pdf.PDFAttachmentTestCase
testAddEmbeddedFileDash(org.apache.fop.pdf.PDFAttachmentTestCase) Time elapsed: 0.003 sec <<< ERROR!
java.lang.IllegalStateException: No embedded file with name filename present.
at org.apache.fop.pdf.PDFFactory.getActionForEmbeddedFile(PDFFactory.java:728)
at org.apache.fop.pdf.PDFFactory.getExternalAction(PDFFactory.java:600)
at org.apache.fop.render.pdf.PDFDocumentNavigationHandler.getAction(PDFDocumentNavigationHandler.java:174)
at org.apache.fop.render.pdf.PDFDocumentNavigationHandler.renderLink(PDFDocumentNavigationHandler.java:108)
at org.apache.fop.pdf.PDFAttachmentTestCase.testAddEmbeddedFileDash(PDFAttachmentTestCase.java:119)