From 2089591b3d2595369e0d32fb9d2f783c87fa9499 Mon Sep 17 00:00:00 2001 From: Jeremias Maerki Date: Thu, 21 Oct 2010 14:12:07 +0000 Subject: [PATCH] Copy attributes since some XML parsers might reuse the Attributes instance. git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@1026006 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/render/afp/extensions/AFPExtensionHandler.java | 3 ++- .../apache/fop/render/pdf/extensions/PDFExtensionHandler.java | 3 ++- .../apache/fop/render/ps/extensions/PSExtensionHandler.java | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/java/org/apache/fop/render/afp/extensions/AFPExtensionHandler.java b/src/java/org/apache/fop/render/afp/extensions/AFPExtensionHandler.java index 5652a49bf..f2e77ec33 100644 --- a/src/java/org/apache/fop/render/afp/extensions/AFPExtensionHandler.java +++ b/src/java/org/apache/fop/render/afp/extensions/AFPExtensionHandler.java @@ -24,6 +24,7 @@ import java.net.URISyntaxException; import org.xml.sax.Attributes; import org.xml.sax.SAXException; +import org.xml.sax.helpers.AttributesImpl; import org.xml.sax.helpers.DefaultHandler; import org.apache.commons.logging.Log; @@ -53,7 +54,7 @@ public class AFPExtensionHandler extends DefaultHandler throws SAXException { boolean handled = false; if (AFPExtensionAttachment.CATEGORY.equals(uri)) { - lastAttributes = attributes; + lastAttributes = new AttributesImpl(attributes); handled = true; if (localName.equals(AFPElementMapping.NO_OPERATION) || localName.equals(AFPElementMapping.TAG_LOGICAL_ELEMENT) 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 d285904a8..04c95545c 100644 --- a/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandler.java +++ b/src/java/org/apache/fop/render/pdf/extensions/PDFExtensionHandler.java @@ -21,6 +21,7 @@ package org.apache.fop.render.pdf.extensions; import org.xml.sax.Attributes; import org.xml.sax.SAXException; +import org.xml.sax.helpers.AttributesImpl; import org.xml.sax.helpers.DefaultHandler; import org.apache.commons.logging.Log; @@ -48,7 +49,7 @@ public class PDFExtensionHandler extends DefaultHandler throws SAXException { boolean handled = false; if (PDFExtensionAttachment.CATEGORY.equals(uri)) { - lastAttributes = attributes; + lastAttributes = new AttributesImpl(attributes); handled = false; if (localName.equals(PDFEmbeddedFileExtensionAttachment.ELEMENT)) { //handled in endElement diff --git a/src/java/org/apache/fop/render/ps/extensions/PSExtensionHandler.java b/src/java/org/apache/fop/render/ps/extensions/PSExtensionHandler.java index dee918f19..bf970d0a6 100644 --- a/src/java/org/apache/fop/render/ps/extensions/PSExtensionHandler.java +++ b/src/java/org/apache/fop/render/ps/extensions/PSExtensionHandler.java @@ -21,6 +21,7 @@ package org.apache.fop.render.ps.extensions; import org.xml.sax.Attributes; import org.xml.sax.SAXException; +import org.xml.sax.helpers.AttributesImpl; import org.xml.sax.helpers.DefaultHandler; import org.apache.commons.logging.Log; @@ -49,7 +50,7 @@ public class PSExtensionHandler extends DefaultHandler throws SAXException { boolean handled = false; if (PSExtensionAttachment.CATEGORY.equals(uri)) { - lastAttributes = attributes; + lastAttributes = new AttributesImpl(attributes); handled = false; if (localName.equals(PSSetupCode.ELEMENT) || localName.equals(PSSetPageDevice.ELEMENT) -- 2.39.5