db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tfisc...@apache.org
Subject svn commit: r535591 - in /db/torque: runtime/trunk/src/java/org/apache/torque/util/Criteria.java runtime/trunk/src/test/org/apache/torque/util/CriteriaTest.java site/trunk/xdocs/changes.xml
Date Sun, 06 May 2007 10:05:07 GMT
Author: tfischer
Date: Sun May  6 03:05:04 2007
New Revision: 535591

URL: http://svn.apache.org/viewvc?view=rev&rev=535591
Log:
Fixed Null Pointer Exceptions in Criteria.equals() and Criteria.hashCode() if joins are null.

Thanks to Sean Gilligan. Fixes TORQUE-90.

Modified:
    db/torque/runtime/trunk/src/java/org/apache/torque/util/Criteria.java
    db/torque/runtime/trunk/src/test/org/apache/torque/util/CriteriaTest.java
    db/torque/site/trunk/xdocs/changes.xml

Modified: db/torque/runtime/trunk/src/java/org/apache/torque/util/Criteria.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/java/org/apache/torque/util/Criteria.java?view=diff&rev=535591&r1=535590&r2=535591
==============================================================================
--- db/torque/runtime/trunk/src/java/org/apache/torque/util/Criteria.java (original)
+++ db/torque/runtime/trunk/src/java/org/apache/torque/util/Criteria.java Sun May  6 03:05:04
2007
@@ -1843,7 +1843,7 @@
                     && orderByColumns.equals(criteria.getOrderByColumns())
                     && ObjectUtils.equals(aliases, criteria.getAliases())
                     && asColumns.equals(criteria.getAsColumns())
-                    && joins.equals(criteria.getJoins())
+                    && ObjectUtils.equals(joins, criteria.getJoins())
                 )
             {
                 isEquiv = true;
@@ -1890,7 +1890,7 @@
         result = 37 * result + orderByColumns.hashCode();
         result = 37 * result + (aliases == null ? 0 : aliases.hashCode());
         result = 37 * result + asColumns.hashCode();
-        result = 37 * result + joins.hashCode();
+        result = 37 * result + (joins == null ? 0 : joins.hashCode());
         result = 37 * result + super.hashCode();
         return result;
     }

Modified: db/torque/runtime/trunk/src/test/org/apache/torque/util/CriteriaTest.java
URL: http://svn.apache.org/viewvc/db/torque/runtime/trunk/src/test/org/apache/torque/util/CriteriaTest.java?view=diff&rev=535591&r1=535590&r2=535591
==============================================================================
--- db/torque/runtime/trunk/src/test/org/apache/torque/util/CriteriaTest.java (original)
+++ db/torque/runtime/trunk/src/test/org/apache/torque/util/CriteriaTest.java Sun May  6 03:05:04
2007
@@ -633,6 +633,20 @@
     }
 
     /**
+     * Test that {@link Criteria#equals(Object)} works correctly for a simple
+     * Criteria object.
+     * @throws TorqueException
+     */
+    public void testEquals() throws TorqueException
+    {
+        c.addSelectColumn("Author.NAME");
+        c.addSelectColumn("Author.AUTHOR_ID");
+        c.add("Author.NAME", "foobar");
+        Criteria cClone = (Criteria) SerializationUtils.clone(c);
+        assertTrue(c.equals(cClone));
+    }
+
+    /**
      * Checks whether orderBy works.
      */
     public void testOrderBy() throws TorqueException

Modified: db/torque/site/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/db/torque/site/trunk/xdocs/changes.xml?view=diff&rev=535591&r1=535590&r2=535591
==============================================================================
--- db/torque/site/trunk/xdocs/changes.xml (original)
+++ db/torque/site/trunk/xdocs/changes.xml Sun May  6 03:05:04 2007
@@ -31,6 +31,10 @@
 
   <body>
   <release version="3.3-RC3" date="in SVN">
+    <action type="fix" dev="tfischer" issue="TORQUE-90" due-to="Sean Gilligan">
+      Fixed Null Pointer Exceptions in Criteria.equals() and
+      Criteria.hashCode() if joins are null. 
+    </action>
     <action type="fix" dev="tfischer">
       Changed the maven2 plugin's datadump goal to accept only a single schema
       xml. Multiple schema xmls produced illegal output. 



---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message