Results 1 to 2 of 2

Thread: Ice.Current.hashCode() can throw a NPE on null enum

  1. #1
    joshmoore is offline Registered User
    Name: Josh Moore
    Organization: Glencoe Software, Inc.
    Project: OMERO, http://trac.openmicroscopy.org.uk/omero
    Join Date
    Feb 2007
    Location
    Germany
    Posts
    115

    Ice.Current.hashCode() can throw a NPE on null enum

    Though it's fairly unlikely to ever get an Ice.Current without mode set, I did run into a NullPointerException while trying to unit test. There doesn't seem to be a good reason for the mode enumeration to not have a null check: (from 3.2.1)

    Code:
        hashCode()
        {   
            int __h = 0;
            if(adapter != null)
            {   
                __h = 5 * __h + adapter.hashCode();
            }
            if(con != null)
            {
                __h = 5 * __h + con.hashCode();
            }
            __h = 5 * __h + id.hashCode();
            if(facet != null)
            {   
                __h = 5 * __h + facet.hashCode();
            }
            if(operation != null)
            {
                __h = 5 * __h + operation.hashCode();
            }
            __h = 5 * __h + mode.hashCode();
            if(ctx != null)
            {
                __h = 5 * __h + ctx.hashCode();
            }
            __h = 5 * __h + requestId;
            return __h;
        }

  2. #2
    benoit's Avatar
    benoit is offline ZeroC Staff
    Name: Benoit Foucher
    Organization: ZeroC, Inc.
    Project: Ice
    Join Date
    Feb 2003
    Location
    Rennes, France
    Posts
    2,196
    Hi,

    Thanks for the bug report. You're right there should be a null check here, we'll fix this!

    Cheers,
    Benoit.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. why is my Ice.Application.communicator() is null?
    By cnhome in forum Help Center
    Replies: 1
    Last Post: 07-01-2010, 11:26 PM
  2. Replies: 1
    Last Post: 04-16-2009, 05:09 AM
  3. Replies: 2
    Last Post: 11-18-2008, 09:06 PM
  4. null sequence in C#
    By chris92 in forum Help Center
    Replies: 3
    Last Post: 09-29-2006, 08:58 AM
  5. Current ICE documentation
    By johnstv3 in forum Help Center
    Replies: 6
    Last Post: 04-22-2004, 07:22 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •