Package: dom4j
Version: 1.6.1+dfsg.2-5
Severity: normal
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu quantal ubuntu-patch openjdk-7-transition

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Dear Maintainer,

In Ubuntu, the attached patch was applied to achieve the following:

  * Fix FTBFS with openjdk-7 (LP: #888121):
    - d/patches/java7-compat.patch: Fix compareTo function in Rule class
      to ensure that comparisions are actually symmetric.

I suspect that the way the Collections.sort() function works has changed in
Java 7 - basically dom4j Rule comparision was a bit broken in that

    r1 > r2 = 1

but

    r2 < r1 = 0 (should be -1)

This causes Java 7 to leave the arraylist intact rather than sorting it.

This patch works with both Java6 and Java7.

Thanks for considering the patch.


- -- System Information:
Debian Release: wheezy/sid
  APT prefers precise-updates
  APT policy: (500, 'precise-updates'), (500, 'precise-security'), (500, 
'precise'), (100, 'precise-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 3.2.0-24-generic (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBCAAGBQJPuhE2AAoJEL/srsug59jDABQQAKyuELfulLsZ22ObDbnWkeRd
mkKqWZLp/dbbximTyx4lqaEa4ZzMgp6WvMzAqRSWyIJXv4C7lb7qlPuo+stBGuKk
HT8VEleWgf68ode2Ss4ATkrbuRU8CavvrO4BDAY4E50cL0pTUiPm8AZSh/POe7os
odqscXIpoqV2AIhJq01kQm6z+X/Fq2VawqGLfPmVGmCLLO7G5vB9SKCs3ADop8kB
Od7P2qegd9plGFLhgDtLkf9ldhUOc1esckmgfkfYuaVOEGvqwV3tkv4tvJqXnYCq
1wYEvL6qOcKa/+6cL6njsynHrbn2Mg7gUHD0La4mbwrazIeJJrw8XLKOEOLV9kmy
SwugP7z7CRcEgQJidjEuhL95xlNrX80/ebgtj7rm3rWbiaTtIwU/DzZntmr94y/6
fWI261CcN3IuFi5TEJsSjcrSC3ofOcNcIWgD92ppJpXpimjuVcmi29YxWWnT3tjj
HfMMncEEbWz5ZvwdVwGS2WSmB2vNWyBLUT4oVGav752xQMQfcDNSWkGTTbzozr+O
kJ4v5UNcJgDqtDiq3GoPOGXxwXQlNBHTr0KBQmRFsnWGWFX7O+5DsMMIZ0BE+Jof
BgD4r6jqUYghvumkYxkCSVwI+bELd1UgY+rCjbL36904KWQutG9KJiqG60Cszr8A
1t3aGn6Se+bG8pC3JYp5
=IIzc
-----END PGP SIGNATURE-----
=== modified file '.pc/applied-patches'
--- .pc/applied-patches	2011-08-17 18:43:40 +0000
+++ .pc/applied-patches	2012-05-21 09:30:00 +0000
@@ -1 +1,2 @@
 oldchanges.patch
+java7-compat.patch

=== added directory '.pc/java7-compat.patch'
=== added directory '.pc/java7-compat.patch/src'
=== added directory '.pc/java7-compat.patch/src/java'
=== added directory '.pc/java7-compat.patch/src/java/org'
=== added directory '.pc/java7-compat.patch/src/java/org/dom4j'
=== added directory '.pc/java7-compat.patch/src/java/org/dom4j/rule'
=== added file '.pc/java7-compat.patch/src/java/org/dom4j/rule/Rule.java'
--- .pc/java7-compat.patch/src/java/org/dom4j/rule/Rule.java	1970-01-01 00:00:00 +0000
+++ .pc/java7-compat.patch/src/java/org/dom4j/rule/Rule.java	2012-05-21 09:29:53 +0000
@@ -0,0 +1,331 @@
+/*
+ * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
+ *
+ * This software is open source.
+ * See the bottom of this file for the licence.
+ */
+
+package org.dom4j.rule;
+
+import org.dom4j.Node;
+
+/**
+ * <p>
+ * <code>Rule</code> matches against DOM4J Node so that some action can be
+ * performed such as in the XSLT processing model.
+ * </p>
+ * 
+ * @author <a href="mailto:james.strac...@metastuff.com">James Strachan </a>
+ * @version $Revision: 1.7 $
+ */
+public class Rule implements Comparable {
+    /** Holds value of property mode. */
+    private String mode;
+
+    /** Holds value of property importPrecedence. */
+    private int importPrecedence;
+
+    /** Holds value of property priority. */
+    private double priority;
+
+    /** Holds value of property appearenceCount. */
+    private int appearenceCount;
+
+    /** Holds value of property pattern. */
+    private Pattern pattern;
+
+    /** Holds value of property action. */
+    private Action action;
+
+    public Rule() {
+        this.priority = Pattern.DEFAULT_PRIORITY;
+    }
+
+    public Rule(Pattern pattern) {
+        this.pattern = pattern;
+        this.priority = pattern.getPriority();
+    }
+
+    public Rule(Pattern pattern, Action action) {
+        this(pattern);
+        this.action = action;
+    }
+
+    /**
+     * Constructs a new Rule with the same instance data as the given rule but a
+     * different pattern.
+     * 
+     * @param that
+     *            DOCUMENT ME!
+     * @param pattern
+     *            DOCUMENT ME!
+     */
+    public Rule(Rule that, Pattern pattern) {
+        this.mode = that.mode;
+        this.importPrecedence = that.importPrecedence;
+        this.priority = that.priority;
+        this.appearenceCount = that.appearenceCount;
+        this.action = that.action;
+        this.pattern = pattern;
+    }
+
+    public boolean equals(Object that) {
+        if (that instanceof Rule) {
+            return compareTo((Rule) that) == 0;
+        }
+
+        return false;
+    }
+
+    public int hashCode() {
+        return importPrecedence + appearenceCount;
+    }
+
+    public int compareTo(Object that) {
+        if (that instanceof Rule) {
+            return compareTo((Rule) that);
+        }
+
+        return getClass().getName().compareTo(that.getClass().getName());
+    }
+
+    /**
+     * Compares two rules in XSLT processing model order assuming that the modes
+     * are equal.
+     * 
+     * @param that
+     *            DOCUMENT ME!
+     * 
+     * @return DOCUMENT ME!
+     */
+    public int compareTo(Rule that) {
+        int answer = this.importPrecedence - that.importPrecedence;
+
+        if (answer == 0) {
+            answer = (int) Math.round(this.priority - that.priority);
+
+            if (answer == 0) {
+                answer = this.appearenceCount - that.appearenceCount;
+            }
+        }
+
+        return answer;
+    }
+
+    public String toString() {
+        return super.toString() + "[ pattern: " + getPattern() + " action: "
+                + getAction() + " ]";
+    }
+
+    /**
+     * DOCUMENT ME!
+     * 
+     * @param node
+     *            DOCUMENT ME!
+     * 
+     * @return true if the pattern matches the given DOM4J node.
+     */
+    public final boolean matches(Node node) {
+        return pattern.matches(node);
+    }
+
+    /**
+     * If this rule contains a union pattern then this method should return an
+     * array of Rules which describe the union rule, which should contain more
+     * than one rule. Otherwise this method should return null.
+     * 
+     * @return an array of the rules which make up this union rule or null if
+     *         this rule is not a union rule
+     */
+    public Rule[] getUnionRules() {
+        Pattern[] patterns = pattern.getUnionPatterns();
+
+        if (patterns == null) {
+            return null;
+        }
+
+        int size = patterns.length;
+        Rule[] answer = new Rule[size];
+
+        for (int i = 0; i < size; i++) {
+            answer[i] = new Rule(this, patterns[i]);
+        }
+
+        return answer;
+    }
+
+    /**
+     * DOCUMENT ME!
+     * 
+     * @return the type of node the pattern matches which by default should
+     *         return ANY_NODE if it can match any kind of node.
+     */
+    public final short getMatchType() {
+        return pattern.getMatchType();
+    }
+
+    /**
+     * For patterns which only match an ATTRIBUTE_NODE or an ELEMENT_NODE then
+     * this pattern may return the name of the element or attribute it matches.
+     * This allows a more efficient rule matching algorithm to be performed,
+     * rather than a brute force approach of evaluating every pattern for a
+     * given Node.
+     * 
+     * @return the name of the element or attribute this pattern matches or null
+     *         if this pattern matches any or more than one name.
+     */
+    public final String getMatchesNodeName() {
+        return pattern.getMatchesNodeName();
+    }
+
+    /**
+     * Getter for property mode.
+     * 
+     * @return Value of property mode.
+     */
+    public String getMode() {
+        return mode;
+    }
+
+    /**
+     * Setter for property mode.
+     * 
+     * @param mode
+     *            New value of property mode.
+     */
+    public void setMode(String mode) {
+        this.mode = mode;
+    }
+
+    /**
+     * Getter for property importPrecedence.
+     * 
+     * @return Value of property importPrecedence.
+     */
+    public int getImportPrecedence() {
+        return importPrecedence;
+    }
+
+    /**
+     * Setter for property importPrecedence.
+     * 
+     * @param importPrecedence
+     *            New value of property importPrecedence.
+     */
+    public void setImportPrecedence(int importPrecedence) {
+        this.importPrecedence = importPrecedence;
+    }
+
+    /**
+     * Getter for property priority.
+     * 
+     * @return Value of property priority.
+     */
+    public double getPriority() {
+        return priority;
+    }
+
+    /**
+     * Setter for property priority.
+     * 
+     * @param priority
+     *            New value of property priority.
+     */
+    public void setPriority(double priority) {
+        this.priority = priority;
+    }
+
+    /**
+     * Getter for property appearenceCount.
+     * 
+     * @return Value of property appearenceCount.
+     */
+    public int getAppearenceCount() {
+        return appearenceCount;
+    }
+
+    /**
+     * Setter for property appearenceCount.
+     * 
+     * @param appearenceCount
+     *            New value of property appearenceCount.
+     */
+    public void setAppearenceCount(int appearenceCount) {
+        this.appearenceCount = appearenceCount;
+    }
+
+    /**
+     * Getter for property pattern.
+     * 
+     * @return Value of property pattern.
+     */
+    public Pattern getPattern() {
+        return pattern;
+    }
+
+    /**
+     * Setter for property pattern.
+     * 
+     * @param pattern
+     *            New value of property pattern.
+     */
+    public void setPattern(Pattern pattern) {
+        this.pattern = pattern;
+    }
+
+    /**
+     * Getter for property action.
+     * 
+     * @return Value of property action.
+     */
+    public Action getAction() {
+        return action;
+    }
+
+    /**
+     * Setter for property action.
+     * 
+     * @param action
+     *            New value of property action.
+     */
+    public void setAction(Action action) {
+        this.action = action;
+    }
+}
+
+/*
+ * Redistribution and use of this software and associated documentation
+ * ("Software"), with or without modification, are permitted provided that the
+ * following conditions are met:
+ * 
+ * 1. Redistributions of source code must retain copyright statements and
+ * notices. Redistributions must also contain a copy of this document.
+ * 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 
+ * 3. The name "DOM4J" must not be used to endorse or promote products derived
+ * from this Software without prior written permission of MetaStuff, Ltd. For
+ * written permission, please contact dom4j-i...@metastuff.com.
+ * 
+ * 4. Products derived from this Software may not be called "DOM4J" nor may
+ * "DOM4J" appear in their names without prior written permission of MetaStuff,
+ * Ltd. DOM4J is a registered trademark of MetaStuff, Ltd.
+ * 
+ * 5. Due credit should be given to the DOM4J Project - http://www.dom4j.org
+ * 
+ * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL METASTUFF, LTD. OR ITS CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ * 
+ * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
+ */

=== added directory '.pc/java7-compat.patch/src/test'
=== added directory '.pc/java7-compat.patch/src/test/org'
=== added directory '.pc/java7-compat.patch/src/test/org/dom4j'
=== added directory '.pc/java7-compat.patch/src/test/org/dom4j/rule'
=== added file '.pc/java7-compat.patch/src/test/org/dom4j/rule/RuleTest.java'
--- .pc/java7-compat.patch/src/test/org/dom4j/rule/RuleTest.java	1970-01-01 00:00:00 +0000
+++ .pc/java7-compat.patch/src/test/org/dom4j/rule/RuleTest.java	2012-05-21 09:02:51 +0000
@@ -0,0 +1,151 @@
+/*
+ * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
+ *
+ * This software is open source.
+ * See the bottom of this file for the licence.
+ */
+
+package org.dom4j.rule;
+
+import junit.textui.TestRunner;
+
+import java.util.ArrayList;
+import java.util.Collections;
+
+import org.dom4j.AbstractTestCase;
+import org.dom4j.CDATA;
+import org.dom4j.Document;
+import org.dom4j.DocumentFactory;
+
+/**
+ * Tests the ordering of Rules
+ * 
+ * @author <a href="mailto:jstrac...@apache.org">James Strachan </a>
+ * @version $Revision: 1.3 $
+ */
+public class RuleTest extends AbstractTestCase {
+    protected DocumentFactory factory = new DocumentFactory();
+
+    public static void main(String[] args) {
+        TestRunner.run(RuleTest.class);
+    }
+
+    public void testOrder() throws Exception {
+        testGreater("foo", "*");
+    }
+
+    protected void testGreater(String expr1, String expr2) throws Exception {
+        System.out.println("parsing: " + expr1 + " and " + expr2);
+
+        Rule r1 = createRule(expr1);
+        Rule r2 = createRule(expr2);
+
+        System.out.println("rule1: " + r1 + " rule2: " + r2);
+
+        int value = r1.compareTo(r2);
+
+        System.out.println("Comparison: " + value);
+
+        assertTrue("r1 > r2", value > 0);
+
+        ArrayList list = new ArrayList();
+        list.add(r1);
+        list.add(r2);
+
+        Collections.sort(list);
+
+        assertTrue("r2 should be first", list.get(0) == r2);
+        assertTrue("r1 should be next", list.get(1) == r1);
+
+        list = new ArrayList();
+        list.add(r2);
+        list.add(r1);
+
+        Collections.sort(list);
+
+        assertTrue("r2 should be first", list.get(0) == r2);
+        assertTrue("r1 should be next", list.get(1) == r1);
+
+        /*
+         * TreeSet set = new TreeSet(); set.add( r1 ); set.add( r2 );
+         * 
+         * assertTrue( "r2 should be first", set.first() == r2 ); assertTrue(
+         * "r1 should be next", set.last() == r1 );
+         * 
+         * Object[] array = set.toArray();
+         * 
+         * assertTrue( "r2 should be first", array[0] == r2 ); assertTrue( "r1
+         * should be next", array[1] == r1 );
+         * 
+         * set = new TreeSet(); set.add( r2 ); set.add( r1 );
+         * 
+         * assertTrue( "r2 should be first", set.first() == r2 ); assertTrue(
+         * "r1 should be next", set.last() == r1 );
+         * 
+         * array = set.toArray();
+         * 
+         * assertTrue( "r2 should be first", array[0] == r2 ); assertTrue( "r1
+         * should be next", array[1] == r1 );
+         */
+    }
+
+    public void testDocument() {
+        Rule rule = createRule("/");
+        Document document = factory.createDocument();
+        document.addElement("foo");
+
+        assertTrue("/ matches document", rule.matches(document));
+        assertTrue("/ does not match root element", !rule.matches(document
+                .getRootElement()));
+    }
+
+    public void testTextMatchesCDATA() {
+        CDATA cdata = factory.createCDATA("<>&");
+        Rule rule = createRule("text()");
+
+        assertTrue("text() matches CDATA", rule.matches(cdata));
+    }
+
+    protected Rule createRule(String expr) {
+        Pattern pattern = factory.createPattern(expr);
+
+        return new Rule(pattern);
+    }
+}
+
+/*
+ * Redistribution and use of this software and associated documentation
+ * ("Software"), with or without modification, are permitted provided that the
+ * following conditions are met:
+ * 
+ * 1. Redistributions of source code must retain copyright statements and
+ * notices. Redistributions must also contain a copy of this document.
+ * 
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * 
+ * 3. The name "DOM4J" must not be used to endorse or promote products derived
+ * from this Software without prior written permission of MetaStuff, Ltd. For
+ * written permission, please contact dom4j-i...@metastuff.com.
+ * 
+ * 4. Products derived from this Software may not be called "DOM4J" nor may
+ * "DOM4J" appear in their names without prior written permission of MetaStuff,
+ * Ltd. DOM4J is a registered trademark of MetaStuff, Ltd.
+ * 
+ * 5. Due credit should be given to the DOM4J Project - http://www.dom4j.org
+ * 
+ * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL METASTUFF, LTD. OR ITS CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ * 
+ * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
+ */

=== modified file 'debian/changelog'

=== modified file 'debian/control'
--- debian/control	2011-08-17 18:43:40 +0000
+++ debian/control	2012-05-21 09:39:38 +0000
@@ -1,7 +1,8 @@
 Source: dom4j
 Section: java
 Priority: optional
-Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
+Maintainer: Ubuntu Developers <ubuntu-devel-disc...@lists.ubuntu.com>
+XSBC-Original-Maintainer: Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>
 Uploaders: Marcus Better <mar...@better.se>, Michael Koch <konque...@gmx.de>
 Build-Depends: debhelper (>= 7), ant-optional, default-jdk, maven-repo-helper, cdbs
 Build-Depends-Indep: antlr, libjaxen-java, libjaxme-java, libxpp2-java, libxpp3-java, libxerces2-java, libxalan2-java (>= 2.7.0), libbackport-util-concurrent-java, junit, libjunitperf-java

=== added file 'debian/patches/java7-compat.patch'
--- debian/patches/java7-compat.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/java7-compat.patch	2012-05-21 09:48:19 +0000
@@ -0,0 +1,63 @@
+Description: Fixup compareTo function in Rule class to be compliant
+ with the Java 7 (and Java 6) API. Comparisons where not symmetric
+ with the upstream handling in this function:
+ .
+    r1 > r2 but ! r2 < r1
+ .
+ Also added extra tests to ensure that comparison works both ways.
+Author: James Page <james.p...@ubuntu.com>
+Forwarded: no
+
+Index: dom4j/src/java/org/dom4j/rule/Rule.java
+===================================================================
+--- dom4j.orig/src/java/org/dom4j/rule/Rule.java	2012-05-21 10:29:53.305207061 +0100
++++ dom4j/src/java/org/dom4j/rule/Rule.java	2012-05-21 10:30:54.217451201 +0100
+@@ -99,16 +99,16 @@
+      * @return DOCUMENT ME!
+      */
+     public int compareTo(Rule that) {
+-        int answer = this.importPrecedence - that.importPrecedence;
+-
+-        if (answer == 0) {
+-            answer = (int) Math.round(this.priority - that.priority);
+-
+-            if (answer == 0) {
+-                answer = this.appearenceCount - that.appearenceCount;
+-            }
++        int answer = 0;
++        if (this.importPrecedence != that.importPrecedence) {
++            answer = this.importPrecedence < that.importPrecedence ? -1 : 1;
++        }
++        else if (this.priority != that.priority) {
++            answer = this.priority < that.priority ? -1 : 1;
++        }
++        else if (this.appearenceCount != that.appearenceCount) {
++            answer = this.appearenceCount < that.appearenceCount ? -1 : 1;
+         }
+-
+         return answer;
+     }
+ 
+Index: dom4j/src/test/org/dom4j/rule/RuleTest.java
+===================================================================
+--- dom4j.orig/src/test/org/dom4j/rule/RuleTest.java	2012-05-21 10:02:51.481930000 +0100
++++ dom4j/src/test/org/dom4j/rule/RuleTest.java	2012-05-21 10:35:19.394504060 +0100
+@@ -48,6 +48,18 @@
+ 
+         assertTrue("r1 > r2", value > 0);
+ 
++        value = r2.compareTo(r1);
++
++        System.out.println("Comparison: " + value);
++
++        assertTrue("r2 < r1", value < 0);
++
++        value = r1.compareTo(r1);
++
++        System.out.println("Comparison: " + value);
++
++        assertTrue("r1 == r1", value == 0);
++
+         ArrayList list = new ArrayList();
+         list.add(r1);
+         list.add(r2);

=== modified file 'debian/patches/oldchanges.patch'
--- debian/patches/oldchanges.patch	2011-08-17 18:43:40 +0000
+++ debian/patches/oldchanges.patch	2012-05-21 09:29:49 +0000
@@ -1,8 +1,10 @@
 This patch should be cleaned up.
 Torsten Werner
 
---- dom4j-1.6.1+dfsg.2.orig/build.xml
-+++ dom4j-1.6.1+dfsg.2/build.xml
+Index: dom4j/build.xml
+===================================================================
+--- dom4j.orig/build.xml	2012-05-21 10:02:51.481930000 +0100
++++ dom4j/build.xml	2012-05-21 10:02:51.481930000 +0100
 @@ -16,13 +16,13 @@
      </path>
  
@@ -82,9 +84,11 @@
          </fileset>
        </batchtest>
      </junit>
---- dom4j-1.6.1+dfsg.2.orig/src/java/org/dom4j/dom/DOMDocumentType.java
-+++ dom4j-1.6.1+dfsg.2/src/java/org/dom4j/dom/DOMDocumentType.java
-@@ -12,7 +12,9 @@ import org.dom4j.tree.DefaultDocumentTyp
+Index: dom4j/src/java/org/dom4j/dom/DOMDocumentType.java
+===================================================================
+--- dom4j.orig/src/java/org/dom4j/dom/DOMDocumentType.java	2012-05-21 10:02:51.481930000 +0100
++++ dom4j/src/java/org/dom4j/dom/DOMDocumentType.java	2012-05-21 10:02:51.481930000 +0100
+@@ -12,7 +12,9 @@
  import org.w3c.dom.DOMException;
  import org.w3c.dom.Document;
  import org.w3c.dom.NamedNodeMap;
@@ -94,7 +98,7 @@
  
  /**
   * <p>
-@@ -177,6 +179,66 @@ public class DOMDocumentType extends Def
+@@ -177,6 +179,66 @@
      public String getInternalSubset() {
          return getElementName();
      }
@@ -161,9 +165,11 @@
  }
  
  /*
---- dom4j-1.6.1+dfsg.2.orig/src/java/org/dom4j/dom/DOMProcessingInstruction.java
-+++ dom4j-1.6.1+dfsg.2/src/java/org/dom4j/dom/DOMProcessingInstruction.java
-@@ -15,7 +15,9 @@ import org.dom4j.tree.DefaultProcessingI
+Index: dom4j/src/java/org/dom4j/dom/DOMProcessingInstruction.java
+===================================================================
+--- dom4j.orig/src/java/org/dom4j/dom/DOMProcessingInstruction.java	2012-05-21 10:02:51.481930000 +0100
++++ dom4j/src/java/org/dom4j/dom/DOMProcessingInstruction.java	2012-05-21 10:02:51.481930000 +0100
+@@ -15,7 +15,9 @@
  import org.w3c.dom.DOMException;
  import org.w3c.dom.Document;
  import org.w3c.dom.NamedNodeMap;
@@ -173,7 +179,7 @@
  
  /**
   * <p>
-@@ -177,6 +179,66 @@ public class DOMProcessingInstruction ex
+@@ -177,6 +179,66 @@
          }
      }
  
@@ -240,9 +246,11 @@
      // Implementation methods
      // -------------------------------------------------------------------------
  }
---- dom4j-1.6.1+dfsg.2.orig/src/java/org/dom4j/dom/DOMAttribute.java
-+++ dom4j-1.6.1+dfsg.2/src/java/org/dom4j/dom/DOMAttribute.java
-@@ -14,7 +14,10 @@ import org.dom4j.tree.DefaultAttribute;
+Index: dom4j/src/java/org/dom4j/dom/DOMAttribute.java
+===================================================================
+--- dom4j.orig/src/java/org/dom4j/dom/DOMAttribute.java	2012-05-21 10:02:51.481930000 +0100
++++ dom4j/src/java/org/dom4j/dom/DOMAttribute.java	2012-05-21 10:02:51.481930000 +0100
+@@ -14,7 +14,10 @@
  import org.w3c.dom.DOMException;
  import org.w3c.dom.Document;
  import org.w3c.dom.NamedNodeMap;
@@ -253,7 +261,7 @@
  
  /**
   * <p>
-@@ -179,6 +182,76 @@ public class DOMAttribute extends Defaul
+@@ -179,6 +182,76 @@
      public org.w3c.dom.Element getOwnerElement() {
          return DOMNodeHelper.asDOMElement(getParent());
      }
@@ -330,9 +338,11 @@
  }
  
  /*
---- dom4j-1.6.1+dfsg.2.orig/src/java/org/dom4j/dom/DOMDocumentFactory.java
-+++ dom4j-1.6.1+dfsg.2/src/java/org/dom4j/dom/DOMDocumentFactory.java
-@@ -174,6 +174,11 @@ public class DOMDocumentFactory extends
+Index: dom4j/src/java/org/dom4j/dom/DOMDocumentFactory.java
+===================================================================
+--- dom4j.orig/src/java/org/dom4j/dom/DOMDocumentFactory.java	2012-05-21 10:02:51.481930000 +0100
++++ dom4j/src/java/org/dom4j/dom/DOMDocumentFactory.java	2012-05-21 10:02:51.481930000 +0100
+@@ -174,6 +174,11 @@
                      docType.getPublicId(), docType.getSystemId());
          }
      }
@@ -344,16 +354,18 @@
  }
  
  
-@@ -213,4 +218,4 @@ public class DOMDocumentFactory extends
+@@ -213,4 +218,4 @@
   * POSSIBILITY OF SUCH DAMAGE.
   * 
   * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
 - */
 \ No newline at end of file
 + */
---- dom4j-1.6.1+dfsg.2.orig/src/java/org/dom4j/dom/DOMComment.java
-+++ dom4j-1.6.1+dfsg.2/src/java/org/dom4j/dom/DOMComment.java
-@@ -13,7 +13,9 @@ import org.dom4j.tree.DefaultComment;
+Index: dom4j/src/java/org/dom4j/dom/DOMComment.java
+===================================================================
+--- dom4j.orig/src/java/org/dom4j/dom/DOMComment.java	2012-05-21 10:02:51.481930000 +0100
++++ dom4j/src/java/org/dom4j/dom/DOMComment.java	2012-05-21 10:02:51.481930000 +0100
+@@ -13,7 +13,9 @@
  import org.w3c.dom.DOMException;
  import org.w3c.dom.Document;
  import org.w3c.dom.NamedNodeMap;
@@ -363,7 +375,7 @@
  
  /**
   * <p>
-@@ -187,6 +189,66 @@ public class DOMComment extends DefaultC
+@@ -187,6 +189,66 @@
              throws DOMException {
          DOMNodeHelper.replaceData(this, offset, count, arg);
      }
@@ -430,9 +442,11 @@
  }
  
  /*
---- dom4j-1.6.1+dfsg.2.orig/src/java/org/dom4j/dom/DOMNamespace.java
-+++ dom4j-1.6.1+dfsg.2/src/java/org/dom4j/dom/DOMNamespace.java
-@@ -13,7 +13,9 @@ import org.dom4j.tree.DefaultNamespace;
+Index: dom4j/src/java/org/dom4j/dom/DOMNamespace.java
+===================================================================
+--- dom4j.orig/src/java/org/dom4j/dom/DOMNamespace.java	2012-05-21 10:02:51.481930000 +0100
++++ dom4j/src/java/org/dom4j/dom/DOMNamespace.java	2012-05-21 10:02:51.481930000 +0100
+@@ -13,7 +13,9 @@
  import org.w3c.dom.DOMException;
  import org.w3c.dom.Document;
  import org.w3c.dom.NamedNodeMap;
@@ -442,7 +456,7 @@
  
  /**
   * <p>
-@@ -140,6 +142,66 @@ public class DOMNamespace extends Defaul
+@@ -140,6 +142,66 @@
      public boolean hasAttributes() {
          return DOMNodeHelper.hasAttributes(this);
      }
@@ -509,9 +523,11 @@
  }
  
  /*
---- dom4j-1.6.1+dfsg.2.orig/src/java/org/dom4j/dom/DOMDocument.java
-+++ dom4j-1.6.1+dfsg.2/src/java/org/dom4j/dom/DOMDocument.java
-@@ -15,12 +15,15 @@ import org.dom4j.tree.DefaultDocument;
+Index: dom4j/src/java/org/dom4j/dom/DOMDocument.java
+===================================================================
+--- dom4j.orig/src/java/org/dom4j/dom/DOMDocument.java	2012-05-21 10:02:51.481930000 +0100
++++ dom4j/src/java/org/dom4j/dom/DOMDocument.java	2012-05-21 10:02:51.481930000 +0100
+@@ -15,12 +15,15 @@
  
  import org.w3c.dom.Attr;
  import org.w3c.dom.CDATASection;
@@ -527,7 +543,7 @@
  
  /**
   * <p>
-@@ -301,6 +304,136 @@ public class DOMDocument extends Default
+@@ -301,6 +304,136 @@
              return super.getDocumentFactory();
          }
      }
@@ -664,9 +680,11 @@
  }
  
  /*
---- dom4j-1.6.1+dfsg.2.orig/src/java/org/dom4j/dom/DOMEntityReference.java
-+++ dom4j-1.6.1+dfsg.2/src/java/org/dom4j/dom/DOMEntityReference.java
-@@ -13,7 +13,9 @@ import org.dom4j.tree.DefaultEntity;
+Index: dom4j/src/java/org/dom4j/dom/DOMEntityReference.java
+===================================================================
+--- dom4j.orig/src/java/org/dom4j/dom/DOMEntityReference.java	2012-05-21 10:02:51.481930000 +0100
++++ dom4j/src/java/org/dom4j/dom/DOMEntityReference.java	2012-05-21 10:02:51.481930000 +0100
+@@ -13,7 +13,9 @@
  import org.w3c.dom.DOMException;
  import org.w3c.dom.Document;
  import org.w3c.dom.NamedNodeMap;
@@ -676,7 +694,7 @@
  
  /**
   * <p>
-@@ -166,6 +168,66 @@ public class DOMEntityReference extends
+@@ -166,6 +168,66 @@
      public boolean hasAttributes() {
          return DOMNodeHelper.hasAttributes(this);
      }
@@ -743,9 +761,11 @@
  }
  
  /*
---- dom4j-1.6.1+dfsg.2.orig/src/java/org/dom4j/dom/DOMText.java
-+++ dom4j-1.6.1+dfsg.2/src/java/org/dom4j/dom/DOMText.java
-@@ -14,7 +14,9 @@ import org.dom4j.tree.DefaultText;
+Index: dom4j/src/java/org/dom4j/dom/DOMText.java
+===================================================================
+--- dom4j.orig/src/java/org/dom4j/dom/DOMText.java	2012-05-21 10:02:51.481930000 +0100
++++ dom4j/src/java/org/dom4j/dom/DOMText.java	2012-05-21 10:02:51.481930000 +0100
+@@ -14,7 +14,9 @@
  import org.w3c.dom.DOMException;
  import org.w3c.dom.Document;
  import org.w3c.dom.NamedNodeMap;
@@ -755,7 +775,7 @@
  
  /**
   * <p>
-@@ -224,6 +226,81 @@ public class DOMText extends DefaultText
+@@ -224,6 +226,81 @@
      protected Text createText(String text) {
          return new DOMText(text);
      }
@@ -837,9 +857,11 @@
  }
  
  /*
---- dom4j-1.6.1+dfsg.2.orig/src/java/org/dom4j/dom/DOMCDATA.java
-+++ dom4j-1.6.1+dfsg.2/src/java/org/dom4j/dom/DOMCDATA.java
-@@ -14,7 +14,10 @@ import org.dom4j.tree.DefaultCDATA;
+Index: dom4j/src/java/org/dom4j/dom/DOMCDATA.java
+===================================================================
+--- dom4j.orig/src/java/org/dom4j/dom/DOMCDATA.java	2012-05-21 10:02:51.481930000 +0100
++++ dom4j/src/java/org/dom4j/dom/DOMCDATA.java	2012-05-21 10:02:51.481930000 +0100
+@@ -14,7 +14,10 @@
  import org.w3c.dom.DOMException;
  import org.w3c.dom.Document;
  import org.w3c.dom.NamedNodeMap;
@@ -850,7 +872,7 @@
  
  /**
   * <p>
-@@ -225,6 +228,81 @@ public class DOMCDATA extends DefaultCDA
+@@ -225,6 +228,81 @@
      protected CDATA createCDATA(String text) {
          return new DOMCDATA(text);
      }
@@ -932,9 +954,11 @@
  }
  
  /*
---- dom4j-1.6.1+dfsg.2.orig/src/java/org/dom4j/dom/DOMElement.java
-+++ dom4j-1.6.1+dfsg.2/src/java/org/dom4j/dom/DOMElement.java
-@@ -16,11 +16,14 @@ import org.dom4j.Namespace;
+Index: dom4j/src/java/org/dom4j/dom/DOMElement.java
+===================================================================
+--- dom4j.orig/src/java/org/dom4j/dom/DOMElement.java	2012-05-21 10:02:51.481930000 +0100
++++ dom4j/src/java/org/dom4j/dom/DOMElement.java	2012-05-21 10:02:51.481930000 +0100
+@@ -16,11 +16,14 @@
  import org.dom4j.QName;
  import org.dom4j.tree.DefaultElement;
  
@@ -949,7 +973,7 @@
  
  /**
   * <p>
-@@ -389,6 +392,86 @@ public class DOMElement extends DefaultE
+@@ -389,6 +392,86 @@
  
          return getDocumentFactory().createQName(localName, prefix, namespace);
      }
@@ -1036,9 +1060,11 @@
  }
  
  /*
---- dom4j-1.6.1+dfsg.2.orig/src/java/org/dom4j/tree/NamespaceCache.java
-+++ dom4j-1.6.1+dfsg.2/src/java/org/dom4j/tree/NamespaceCache.java
-@@ -26,42 +26,46 @@ import org.dom4j.Namespace;
+Index: dom4j/src/java/org/dom4j/tree/NamespaceCache.java
+===================================================================
+--- dom4j.orig/src/java/org/dom4j/tree/NamespaceCache.java	2012-05-21 10:02:51.481930000 +0100
++++ dom4j/src/java/org/dom4j/tree/NamespaceCache.java	2012-05-21 10:02:51.481930000 +0100
+@@ -26,42 +26,46 @@
   * @version $Revision: 1.15 $
   */
  public class NamespaceCache {
@@ -1100,7 +1126,7 @@
              }
          }
      }
-@@ -154,7 +158,7 @@ public class NamespaceCache {
+@@ -154,7 +158,7 @@
                  answer = (Map) cache.get(uri);
  
                  if (answer == null) {
@@ -1109,9 +1135,11 @@
                      cache.put(uri, answer);
                  }
              }
---- dom4j-1.6.1+dfsg.2.orig/src/test/org/dom4j/xpath/MatrixConcatTest.java
-+++ dom4j-1.6.1+dfsg.2/src/test/org/dom4j/xpath/MatrixConcatTest.java
-@@ -33,9 +33,11 @@ public class MatrixConcatTest extends Ab
+Index: dom4j/src/test/org/dom4j/xpath/MatrixConcatTest.java
+===================================================================
+--- dom4j.orig/src/test/org/dom4j/xpath/MatrixConcatTest.java	2012-05-21 10:02:51.481930000 +0100
++++ dom4j/src/test/org/dom4j/xpath/MatrixConcatTest.java	2012-05-21 10:02:51.481930000 +0100
+@@ -33,9 +33,11 @@
  
          String[] exp2 = {"EQUITY_BAR_CF1", "EQUITY_BAR_CF2", "EQUITY_BAR_CF3"};
  
@@ -1123,8 +1151,10 @@
      }
  
      // Implementation methods
---- dom4j-1.6.1+dfsg.2.orig/xml/bean/gui.xml
-+++ dom4j-1.6.1+dfsg.2/xml/bean/gui.xml
+Index: dom4j/xml/bean/gui.xml
+===================================================================
+--- dom4j.orig/xml/bean/gui.xml	2012-05-21 10:02:51.481930000 +0100
++++ dom4j/xml/bean/gui.xml	2012-05-21 10:02:51.481930000 +0100
 @@ -1,5 +1,5 @@
  <?xml version="1.0" encoding="UTF-8"?>
  <widgets>

=== modified file 'debian/patches/series'
--- debian/patches/series	2011-08-17 18:43:40 +0000
+++ debian/patches/series	2012-05-21 09:30:00 +0000
@@ -1 +1,2 @@
 oldchanges.patch
+java7-compat.patch

=== modified file 'src/java/org/dom4j/rule/Rule.java'
--- src/java/org/dom4j/rule/Rule.java	2006-10-09 21:24:19 +0000
+++ src/java/org/dom4j/rule/Rule.java	2012-05-21 09:30:54 +0000
@@ -99,16 +99,16 @@
      * @return DOCUMENT ME!
      */
     public int compareTo(Rule that) {
-        int answer = this.importPrecedence - that.importPrecedence;
-
-        if (answer == 0) {
-            answer = (int) Math.round(this.priority - that.priority);
-
-            if (answer == 0) {
-                answer = this.appearenceCount - that.appearenceCount;
-            }
-        }
-
+        int answer = 0;
+        if (this.importPrecedence != that.importPrecedence) {
+            answer = this.importPrecedence < that.importPrecedence ? -1 : 1;
+        }
+        else if (this.priority != that.priority) {
+            answer = this.priority < that.priority ? -1 : 1;
+        }
+        else if (this.appearenceCount != that.appearenceCount) {
+            answer = this.appearenceCount < that.appearenceCount ? -1 : 1;
+        }
         return answer;
     }
 

=== modified file 'src/test/org/dom4j/rule/RuleTest.java'
--- src/test/org/dom4j/rule/RuleTest.java	2006-10-09 21:24:19 +0000
+++ src/test/org/dom4j/rule/RuleTest.java	2012-05-21 09:35:19 +0000
@@ -48,6 +48,18 @@
 
         assertTrue("r1 > r2", value > 0);
 
+        value = r2.compareTo(r1);
+
+        System.out.println("Comparison: " + value);
+
+        assertTrue("r2 < r1", value < 0);
+
+        value = r1.compareTo(r1);
+
+        System.out.println("Comparison: " + value);
+
+        assertTrue("r1 == r1", value == 0);
+
         ArrayList list = new ArrayList();
         list.add(r1);
         list.add(r2);

__
This is the maintainer address of Debian's Java team
<http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-maintainers>. 
Please use
debian-j...@lists.debian.org for discussions and questions.

Reply via email to