Comment 1 for bug 788479

Revision history for this message
Matt Giuca (mgiuca) wrote :

Wow, we're a bit screwed here. The problem is this: new Long(4) == new Long(4) is false.

Because all of our primary keys in the client classes are Longs, not longs, comparing them with == is doing a reference check to see whether the Long container is equal to the other Long container. Somehow, this works on the dev mode, but it doesn't on production.

In this particular case, the offending line is in UserServiceImpl.getByName, line 57:
        ClientView cv = (curUser.getPrimaryKey() == ud.getPrimaryKey()) ?
                                        ClientView.PRIVATE : ClientView.PUBLIC;

That needs to be
         ClientView cv = (curUser.getPrimaryKey().equals(ud.getPrimaryKey())) ?
                                        ClientView.PRIVATE : ClientView.PUBLIC;

That fixes this particular problem on production, but who knows what else is buggy because of these sort of comparisons. (Basically all permissions are checked using ==.)