Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Accumulo >> mail # dev >> Re: svn commit: r1384121 - /accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java


Copy link to this message
-
Re: svn commit: r1384121 - /accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/commands/UserPermissionsCommand.java
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 = ", ";
>        }
>
>
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB