I saw this when looking through the find bugs report before. When I saw it I was wondering if the p != null check was even needed. The code is looping over SystemPermission.values(). I think values() is a built in enum method, and I would think that it would never return null.
On Wed, Sep 12, 2012 at 5:00 PM, <[email protected]> wrote: > Author: medined > Date: Wed Sep 12 21:00:11 2012 > New Revision: 1384121 > > URL: http://svn.apache.org/viewvc?rev=1384121&view=rev > Log: > fixed incorrect null pointer check > > Modified: > > accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java > > Modified: > accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java > URL: > http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java?rev=1384121&r1=1384120&r2=1384121&view=diff > ============================================================================== > --- > accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java > (original) > +++ > accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java > Wed Sep 12 21:00:11 2012 > @@ -39,7 +39,7 @@ public class UserPermissionsCommand exte > String delim = ""; > shellState.getReader().printString("System permissions: "); > for (SystemPermission p : SystemPermission.values()) { > - if > (shellState.getConnector().securityOperations().hasSystemPermission(user, p) > & p != null) { > + if (p != null && > shellState.getConnector().securityOperations().hasSystemPermission(user, p)) { > shellState.getReader().printString(delim + "System." + p.name()); > delim = ", "; > } > >
