[jboss-dev-forums] [Design of Messaging on JBoss (Messaging/JBoss)] - Re: .NET Client Conversion

timfox do-not-reply at jboss.com
Tue Feb 3 02:32:07 EST 2009


"clebert.suconic at jboss.com" wrote : There is an issue on the SimpleString hashCode calculation.
  | 
  | 
  | This loop:
  | 
  |    public int hashCode()
  |   |    {
  |   |       if (hash == 0)
  |   |       {
  |   |          for (int i = 0; i < data.length; i++)
  |   |          {
  |   |             hash = 31 * hash + data;
  |   |          }
  |   |       }
  |   | 
  |   |       return hash;
  |   |    }
  |   | 
  |   | 
  | 
  | 
  | Is eventually overflowing MaxInt, and that's considered an Exception in C#.
  | 
  | I'm looking to how hashes are calculated in mono, and I will try using the same function.
  | 
  | 
  | 

It should be the same to wrap it back to -MAX_INTEGER if .net doesn't do that automatically

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4206441#4206441

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4206441



More information about the jboss-dev-forums mailing list