This is an automated email from the git hooks/post-receive script. ebourg-guest pushed a commit to branch master in repository xmlgraphics-commons.
commit 336fcaa31a17d4f6268237462eff90442b3657bc Author: Vincent Fourmond <[email protected]> Date: Mon Dec 20 20:45:00 2010 +0000 [xmlgraphics-common] Applied patches by Brian M. Carlson regarding problems with XMP --- debian/changelog | 7 ++ debian/patches/series | 2 + debian/patches/xml-rdf-resource.patch | 130 ++++++++++++++++++++++++++++++++++ debian/patches/xml-top-level.patch | 17 +++++ 4 files changed, 156 insertions(+) diff --git a/debian/changelog b/debian/changelog index de775c8..81b2690 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +xmlgraphics-commons (1.4.dfsg-2) experimental; urgency=low + + * Applied patches by Brian M. Carlson <[email protected]> + to fix various problems with XMP (closes: #605940, #605941) + + -- Vincent Fourmond <[email protected]> Mon, 20 Dec 2010 21:43:24 +0100 + xmlgraphics-commons (1.4.dfsg-1) experimental; urgency=low [ Mathieu Malaterre ] diff --git a/debian/patches/series b/debian/patches/series new file mode 100644 index 0000000..0e95cd0 --- /dev/null +++ b/debian/patches/series @@ -0,0 +1,2 @@ +xml-top-level.patch +xml-rdf-resource.patch diff --git a/debian/patches/xml-rdf-resource.patch b/debian/patches/xml-rdf-resource.patch new file mode 100644 index 0000000..207356a --- /dev/null +++ b/debian/patches/xml-rdf-resource.patch @@ -0,0 +1,130 @@ +Index: xmlgraphics-commons-1.4.dfsg/src/java/org/apache/xmlgraphics/xmp/XMPArray.java +=================================================================== +--- xmlgraphics-commons-1.4.dfsg.orig/src/java/org/apache/xmlgraphics/xmp/XMPArray.java 2010-12-20 21:38:39.387336352 +0100 ++++ xmlgraphics-commons-1.4.dfsg/src/java/org/apache/xmlgraphics/xmp/XMPArray.java 2010-12-20 21:39:14.891670733 +0100 +@@ -19,6 +19,8 @@ + + package org.apache.xmlgraphics.xmp; + ++import java.net.URI; ++ + import java.util.List; + + import org.xml.sax.ContentHandler; +@@ -216,15 +218,19 @@ + for (int i = 0, c = values.size(); i < c; i++) { + String lang = (String)xmllang.get(i); + atts.clear(); ++ Object v = values.get(i); + if (lang != null) { + atts.addAttribute(XMPConstants.XML_NS, "lang", "xml:lang", "CDATA", lang); + } ++ if (v instanceof URI) { ++ atts.addAttribute(XMPConstants.RDF_NAMESPACE, "resource", ++ "rdf:resource", "CDATA", ((URI)v).toString()); ++ } + handler.startElement(XMPConstants.RDF_NAMESPACE, + "li", "rdf:li", atts); +- Object v = values.get(i); + if (v instanceof XMPComplexValue) { + ((XMPComplexValue)v).toSAX(handler); +- } else { ++ } else if (!(v instanceof URI)) { + String value = (String)values.get(i); + char[] chars = value.toCharArray(); + handler.characters(chars, 0, chars.length); +Index: xmlgraphics-commons-1.4.dfsg/src/java/org/apache/xmlgraphics/xmp/XMPHandler.java +=================================================================== +--- xmlgraphics-commons-1.4.dfsg.orig/src/java/org/apache/xmlgraphics/xmp/XMPHandler.java 2010-12-20 21:39:04.295336685 +0100 ++++ xmlgraphics-commons-1.4.dfsg/src/java/org/apache/xmlgraphics/xmp/XMPHandler.java 2010-12-20 21:39:14.891670733 +0100 +@@ -19,6 +19,9 @@ + + package org.apache.xmlgraphics.xmp; + ++import java.net.URI; ++import java.net.URISyntaxException; ++ + import java.util.Stack; + + import org.xml.sax.Attributes; +@@ -233,6 +236,15 @@ + } else { + getCurrentArray(true).add(s); + } ++ } else { ++ String res = atts.getValue(XMPConstants.RDF_NAMESPACE, ++ "resource"); ++ try { ++ URI resource = new URI(res); ++ getCurrentArray(true).add(resource); ++ } catch (URISyntaxException e) { ++ throw new SAXException("rdf:resource value is not a well-formed URI", e); ++ } + } + } + } else if ("Description".equals(localName)) { +@@ -267,9 +279,18 @@ + String s = content.toString().trim(); + prop = new XMPProperty(name, s); + String lang = atts.getValue(XMPConstants.XML_NS, "lang"); ++ String res = atts.getValue(XMPConstants.RDF_NAMESPACE, "resource"); + if (lang != null) { + prop.setXMLLang(lang); + } ++ if (res != null) { ++ try { ++ URI resource = new URI(res); ++ prop.setValue(resource); ++ } catch (URISyntaxException e) { ++ throw new SAXException("rdf:resource value is not a well-formed URI", e); ++ } ++ } + } + if (prop.getName() == null) { + throw new IllegalStateException("No content in XMP property"); +Index: xmlgraphics-commons-1.4.dfsg/src/java/org/apache/xmlgraphics/xmp/XMPProperty.java +=================================================================== +--- xmlgraphics-commons-1.4.dfsg.orig/src/java/org/apache/xmlgraphics/xmp/XMPProperty.java 2010-12-20 21:38:39.403336472 +0100 ++++ xmlgraphics-commons-1.4.dfsg/src/java/org/apache/xmlgraphics/xmp/XMPProperty.java 2010-12-20 21:39:14.891670733 +0100 +@@ -19,6 +19,8 @@ + + package org.apache.xmlgraphics.xmp; + ++import java.net.URI; ++ + import java.util.Iterator; + import java.util.Map; + +@@ -38,6 +40,7 @@ + private Object value; + private String xmllang; + private Map qualifiers; ++ private boolean uri; + + /** + * Creates a new XMP property. +@@ -47,6 +50,7 @@ + public XMPProperty(QName name, Object value) { + this.name = name; + this.value = value; ++ this.uri = false; + } + + /** @return the qualified name of the property (namespace URI + local name) */ +@@ -192,12 +196,15 @@ + public void toSAX(ContentHandler handler) throws SAXException { + AttributesImpl atts = new AttributesImpl(); + String qName = getEffectiveQName(); ++ if (value instanceof URI) { ++ atts.addAttribute(XMPConstants.RDF_NAMESPACE, "resource", "rdf:resource", "CDATA", ((URI)value).toString()); ++ } + handler.startElement(getName().getNamespaceURI(), + getName().getLocalName(), qName, atts); + if (value instanceof XMPComplexValue) { + XMPComplexValue cv = ((XMPComplexValue)value); + cv.toSAX(handler); +- } else { ++ } else if (!(value instanceof URI)) { + char[] chars = value.toString().toCharArray(); + handler.characters(chars, 0, chars.length); + } diff --git a/debian/patches/xml-top-level.patch b/debian/patches/xml-top-level.patch new file mode 100644 index 0000000..cce0e82 --- /dev/null +++ b/debian/patches/xml-top-level.patch @@ -0,0 +1,17 @@ +Index: xmlgraphics-commons-1.4.dfsg/src/java/org/apache/xmlgraphics/xmp/XMPHandler.java +=================================================================== +--- xmlgraphics-commons-1.4.dfsg.orig/src/java/org/apache/xmlgraphics/xmp/XMPHandler.java 2010-12-20 21:38:39.391336779 +0100 ++++ xmlgraphics-commons-1.4.dfsg/src/java/org/apache/xmlgraphics/xmp/XMPHandler.java 2010-12-20 21:39:04.295336685 +0100 +@@ -188,6 +188,12 @@ + throw new SAXException("Unexpected element in the RDF namespace: " + localName); + } + } else { ++ String about = attributes.getValue(XMPConstants.RDF_NAMESPACE, "about"); ++ if (this.contextStack.peek().equals(this.meta) && (about != null)) { ++ //rdf:RDF is the parent, so this is a top-level item that isn't ++ //an rdf:Description, which isn't allowed. ++ throw new SAXException("Top-level element " + qName + " not an rdf:Description"); ++ } + if (getCurrentPropName() != null) { + //Structure (shorthand form) + startStructure(); -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/xmlgraphics-commons.git _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

