Go Back   ZeroC Forums > Bug Reports

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 08-17-2007
joshmoore 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: 54
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;
    }
Reply With Quote
  #2 (permalink)  
Old 08-20-2007
benoit's Avatar
benoit benoit is offline
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,498
Hi,

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

Cheers,
Benoit.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
null sequence in C# chris92 Help Center 3 09-29-2006 08:58 AM
Java: going from String to Enum Type nightnday Help Center 2 03-21-2006 02:32 PM
Why does Evictor throw the following exception? kent Help Center 2 01-06-2006 05:01 PM
what can Monitor::wait() throw? andhow Help Center 4 02-21-2005 08:26 AM
Current ICE documentation johnstv3 Help Center 6 04-22-2004 07:22 AM


All times are GMT -4. The time now is 07:40 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.