[pkg-java] r13184 - in trunk/xmlgraphics-commons/debian: . patches

Vincent Fourmond fourmond at alioth.debian.org
Mon Dec 20 20:45:01 UTC 2010


Author: fourmond
Date: 2010-12-20 20:45:00 +0000 (Mon, 20 Dec 2010)
New Revision: 13184

Added:
   trunk/xmlgraphics-commons/debian/patches/
   trunk/xmlgraphics-commons/debian/patches/series
   trunk/xmlgraphics-commons/debian/patches/xml-rdf-resource.patch
   trunk/xmlgraphics-commons/debian/patches/xml-top-level.patch
Modified:
   trunk/xmlgraphics-commons/debian/changelog
Log:
[xmlgraphics-common] Applied patches by Brian M. Carlson regarding problems with XMP

Modified: trunk/xmlgraphics-commons/debian/changelog
===================================================================
--- trunk/xmlgraphics-commons/debian/changelog	2010-12-19 19:03:31 UTC (rev 13183)
+++ trunk/xmlgraphics-commons/debian/changelog	2010-12-20 20:45:00 UTC (rev 13184)
@@ -1,3 +1,10 @@
+xmlgraphics-commons (1.4.dfsg-2) experimental; urgency=low
+
+  * Applied patches by Brian M. Carlson <sandals at crustytoothpaste.net>
+    to fix various problems with XMP (closes: #605940, #605941)
+
+ -- Vincent Fourmond <fourmond at debian.org>  Mon, 20 Dec 2010 21:43:24 +0100
+
 xmlgraphics-commons (1.4.dfsg-1) experimental; urgency=low
 
   [ Mathieu Malaterre ]

Added: trunk/xmlgraphics-commons/debian/patches/series
===================================================================
--- trunk/xmlgraphics-commons/debian/patches/series	                        (rev 0)
+++ trunk/xmlgraphics-commons/debian/patches/series	2010-12-20 20:45:00 UTC (rev 13184)
@@ -0,0 +1,2 @@
+xml-top-level.patch
+xml-rdf-resource.patch

Added: trunk/xmlgraphics-commons/debian/patches/xml-rdf-resource.patch
===================================================================
--- trunk/xmlgraphics-commons/debian/patches/xml-rdf-resource.patch	                        (rev 0)
+++ trunk/xmlgraphics-commons/debian/patches/xml-rdf-resource.patch	2010-12-20 20:45:00 UTC (rev 13184)
@@ -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);
+         }

Added: trunk/xmlgraphics-commons/debian/patches/xml-top-level.patch
===================================================================
--- trunk/xmlgraphics-commons/debian/patches/xml-top-level.patch	                        (rev 0)
+++ trunk/xmlgraphics-commons/debian/patches/xml-top-level.patch	2010-12-20 20:45:00 UTC (rev 13184)
@@ -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();




More information about the pkg-java-commits mailing list