From: Jeremias Maerki Date: Thu, 21 Oct 2010 14:12:07 +0000 (+0000) Subject: Copy attributes since some XML parsers might reuse the Attributes instance. X-Git-Tag: fop-1_1rc1old~423 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2089591b3d2595369e0d32fb9d2f783c87fa9499;p=xmlgraphics-fop.git 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 --- 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)