db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christopher Fitch <domin...@midsouth.rr.com>
Subject NPE in Criteria.hashCode()
Date Tue, 04 Apr 2006 21:23:51 GMT
Hello,
   I just discovered an issue with the org.apache.torque.util.Criteria 
class.

Apologies if this is the incorrect list to mention this.

Version info: Torque 3.2
When a call to hashCode() is made, a NullPointerException is thrown.

Here's a very simple app that demonstrates the problem:

 >>>>> Begin CriteriaNPE.java
package torque_test;

import org.apache.torque.util.Criteria;

public class CriteriaNPE
{
     public static void main(String[] args)
     {
         try
         {
             Criteria c = new Criteria();
             System.out.println("Criteria hashcode(1): "+c.hashCode());
         }
         catch (Exception ex)
         {
	    ex.printStackTrace();
         }
         try
         {
             Criteria c = new Criteria();
             c.add("Blah","Blah");
             System.out.println("Criteria hashcode(2): "+c.hashCode());
         }
         catch (Exception ex)
         {
             ex.printStackTrace();
         }
     }
}
<<<<< End CriteriaNPE.java

Output returned:
java.lang.NullPointerException
         at org.apache.torque.util.Criteria.hashCode(Criteria.java:1881)
         at torque_test.CriteriaNPE.main(CriteriaNPE.java:12)
java.lang.NullPointerException
         at org.apache.torque.util.Criteria.hashCode(Criteria.java:1881)
         at torque_test.CriteriaNPE.main(CriteriaNPE.java:22)


The prior implementation from 3.1.1 used to function correctly. Now the 
above example is contrived, but I run in to the same issue with code 
that worked on 3.1.1. In that case, the failure occurs in
Criteria.java at line 1887:
         result = 37 * result + joins.hashCode();

because the variable joins is null.

Thanks for any help in advance!

-- 
Christopher Fitch - dominatr@midsouth.rr.com



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


Mime
View raw message