From c85d08c4b9adbf8135e18ad9c3f94e3469e4e12e Mon Sep 17 00:00:00 2001 From: Luca Furini Date: Sat, 14 Feb 2015 10:55:13 +0000 Subject: [PATCH] FOP-2348: - fixing inconsistencies in attribute names when serializing / deserializing extension data, which caused data loss - adding testcase to avoid unsignalled regressions git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1659776 13f79535-47bb-0310-9956-ffa450edef68 --- .../extensions/PDFEmbeddedFileAttachment.java | 2 +- .../pdf/extensions/PDFExtensionHandler.java | 2 +- .../pdf-embedded-file-extension.xml | 58 +++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 test/layoutengine/standard-testcases/pdf-embedded-file-extension.xml diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileAttachment.java b/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileAttachment.java index f00fc2635..8a6e76ba9 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileAttachment.java +++ b/src/java/org/apache/fop/render/pdf/extensions/PDFEmbeddedFileAttachment.java @@ -40,7 +40,7 @@ public class PDFEmbeddedFileAttachment extends PDFExtensionAttachment { private static final String ATT_SRC = "src"; /** a description of the file to be embedded */ - private static final String ATT_DESC = "desc"; + private static final String ATT_DESC = "description"; /** filename attribute */ private String filename; diff --git a/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandler.java b/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandler.java index fb0647fd5..2d53c33bf 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandler.java +++ b/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandler.java @@ -154,7 +154,7 @@ public class PDFExtensionHandler extends DefaultHandler implements ContentHandle public void endElement(String uri, String localName, String qName) throws SAXException { if (PDFExtensionAttachment.CATEGORY.equals(uri)) { if (PDFEmbeddedFileAttachment.ELEMENT.equals(localName)) { - String name = lastAttributes.getValue("name"); + String name = lastAttributes.getValue("filename"); String src = lastAttributes.getValue("src"); String desc = lastAttributes.getValue("description"); this.lastAttributes = null; diff --git a/test/layoutengine/standard-testcases/pdf-embedded-file-extension.xml b/test/layoutengine/standard-testcases/pdf-embedded-file-extension.xml new file mode 100644 index 000000000..43ffd312e --- /dev/null +++ b/test/layoutengine/standard-testcases/pdf-embedded-file-extension.xml @@ -0,0 +1,58 @@ + + + + + +

+ This test checks the PDF embedded file extension, + and a link to an embedded file. +

+
+ + + + + + + + + + + + + + See the + attached file + + + + + + + + + + + + + + + + + +
\ No newline at end of file -- 2.39.5