> On Jan 8, 2016, at 1:15 AM, Jan Sindberg <[email protected]> wrote:
> 
> [snip]
> 
> Using sessionPermissions works great. It lead me to discover that the equals 
> method on Permission is ignoring object id.
> 
> We started with this
> private boolean permissionExistsForSession(Permission _permission)
>  {
>    return cache.contains(_permission);
>  }
> 
> And ended with this
> private boolean permissionExistsForSession(Permission _permission)
>  {
>    int index = cache.indexOf(_permission);
>    if(index > -1)
>    {
>      Permission cachedPerm = cache.get(index);
> 
>      if(cachedPerm.getObjId() == null && _permission.getObjId() == null)
>      {
>        return true;
>      }
> 
>      if(cachedPerm.getObjId() != null && _permission.getObjId() != null && 
> cachedPerm.getObjId().equals(_permission.getObjId()))
>      {
>        return true;
>      }
>    }
>    return false;
>  }
> 
> Checking for object id in Permission.equals would be a nice addition :-)

Nice catch Jan.  Yes, that is a bug and must be added.  Do you want to add the 
JIRA?  How about doing the coding?  :-)

Thanks,

Shawn

Reply via email to