Home Bug Reports

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

joshmoorejoshmoore GermanyMember Josh MooreOrganization: Glencoe Software, Inc.Project: OME, http://openmicroscopy.org
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)
    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;
    }   

Comments

  • benoitbenoit Rennes, FranceAdministrators, ZeroC Staff Benoit FoucherOrganization: ZeroC, Inc.Project: Ice ZeroC Staff
    Hi,

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

    Cheers,
    Benoit.
Sign In or Register to comment.