db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Fischer <fisc...@seitenbau.net>
Subject RE: NPE in Criteria.hashCode()
Date Wed, 05 Apr 2006 09:00:18 GMT
This is a bug, which needs fixing in Torque's source code.

Could you please create an entry in Torque's bug tracker ?

     Thanks,

            Thomas
Christopher Fitch <dominatr@midsouth.rr.com> schrieb am 04.04.2006
23:23:51:

> 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
>


---------------------------------------------------------------------
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