classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Strange failure [Fwd: Mail delivery failed: returning message to sen


From: Meskauskas Audrius
Subject: Re: Strange failure [Fwd: Mail delivery failed: returning message to sender]
Date: Fri, 02 Dec 2005 18:52:14 +0100
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

Hello, Mark,

XOR maybe also would be good enough, but the hashcode method is called very seldom for this class. It is not involved into the main functionality and is only needed in some very specific cases like verifying the client identity. Hence the execution speed may not matter very much; I have chosed Adler as more reliable.

Mark Wielaard wrote:

Hi Audrius,

Just tried to sent this message, but it bounced. Trying from my other
email address now. Any idea why this is happening?

Cheers,

Mark

------------------------------------------------------------------------

Subject:
Mail delivery failed: returning message to sender
From:
Mail Delivery System <address@hidden>
Date:
Fri, 02 Dec 2005 15:10:20 +0100
To:
address@hidden

To:
address@hidden


This message was created automatically by mail delivery software (Exim).

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

 address@hidden
   SMTP error from remote mailer after RCPT TO:<address@hidden>:
   host mxbw.bluewin.ch [195.186.18.144]: 550 RCPT TO:<address@hidden> Relaying 
not allowed

------ This is a copy of the message, including all the headers. ------

Return-path: <address@hidden>
Received: from elsschot.wildebeest.org ([192.168.1.26])
        by gnu.wildebeest.org with esmtp (Exim 3.36 #1 (Debian))
        id 1EiBbn-0008L9-00; Fri, 02 Dec 2005 15:09:55 +0100
Subject: Re: [cp-patches] FYI: Fixes in org.omg.CORBA.Object._is_equivalent.
From: Mark Wielaard <address@hidden>
To: address@hidden
Cc: "_ PATCHES address@hidden" <address@hidden>
In-Reply-To: <address@hidden>
References: <address@hidden>
Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; 
boundary="=-UM7aozFctzAkjF67KfYe"
Date: Fri, 02 Dec 2005 15:11:18 +0100
Message-Id: <address@hidden>
Mime-Version: 1.0
X-Mailer: Evolution 2.2.3

--=-UM7aozFctzAkjF67KfYe
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Hi Audrius,

Going through some older patches.

On Sun, 2005-11-06 at 14:24 +0100, Meskauskas Audrius wrote:
+  /**
+   * Get the hashcode of this IOR.
+   */
+  public int hashCode()
+  {
+    Adler32 adler =3D new Adler32();
+    if (key !=3D null)
+      adler.update(key);
+    if (Internet !=3D null && Internet.host !=3D null)
+      adler.update(Internet.host.getBytes());
+
+    return (int) adler.getValue();
  }

You often use the result of an Adler32 checksum as hashCode() value.
Wouldn't it be more efficient to just simply xor the relevant fields? In
the followup patch you also correctly add the port number so in this
case it would be:

public int hashCode()
{
 int hash =3D 0;
 if (key !=3D null)
   for (int i =3D 0; i < key.length; i++)
     hash ^=3D key[i];
 if (Internet !=3D null && Internet.host !=3D null)
   {
     byte[] bs =3D Internet.host.getBytes();
     for (int i =3D 0; i < bs.length; i++)
       hash ^=3D bs[i];
     hash ^=3D Internet.port;
   }
 return hash;
}

Which seems more efficient. But maybe that isn't a good enough hash
function in this case and maybe using Adler32 isn't that much overhead.
Just wondering why you use it.

Cheers,

Mark

--=-UM7aozFctzAkjF67KfYe
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

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

iD8DBQBDkFYGxVhZCJWr9QwRArLPAKCMfJbPTKy4tXFDruQ2mLAedTnKoQCfXeqv
NbZH7UqgoLhglO1GCqo3+Fo=
=8d4R
-----END PGP SIGNATURE-----

--=-UM7aozFctzAkjF67KfYe--








reply via email to

[Prev in Thread] Current Thread [Next in Thread]