Comment 3 for bug 788479

Perhaps we can do a find and replace of all instances of ==, since
most of the comparisons will be based on references like this.

On 26/05/2011, at 4:01 PM, Matt Giuca <email address hidden> 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 ==.)
>
> --
> You received this bug notification because you are subscribed to
> MUGLE.
> https://bugs.launchpad.net/bugs/788479
>
> Title:
> Non-admin users cannot edit own profile (production)
>
> Status in Melbourne University Game-based Learning Environment:
> In Progress
>
> Bug description:
> Non-admin users have userCanEdit set to false (can't see the edit
> button or access the edit page) for their own User objects. This is
> not a problem for devteams or games, only users. It only shows up on
> the production server; the testing server (including the gwtc
> compiled
> code) does not exhibit this problem.