You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "Josh Elser (JIRA)" <ji...@apache.org> on 2014/10/10 21:16:34 UTC

[jira] [Created] (ACCUMULO-3223) DefaultLoadBalancer allows a NPE just to catch it

Josh Elser created ACCUMULO-3223:
------------------------------------

             Summary: DefaultLoadBalancer allows a NPE just to catch it
                 Key: ACCUMULO-3223
                 URL: https://issues.apache.org/jira/browse/ACCUMULO-3223
             Project: Accumulo
          Issue Type: Sub-task
          Components: master
    Affects Versions: 1.6.1, 1.5.2
            Reporter: Josh Elser
            Assignee: Josh Elser
            Priority: Trivial
             Fix For: 1.5.3, 1.6.2, 1.7.0


{{getOnlineTabletsForTable}} can return null for a couple of different reasons. The try/catch prevents the NPE from filtering up, but it is a confusing situation that can be re-written to be more clear. 

{code:title=DefaultLoadBalancer.java}
      Map<KeyExtent,TabletStats> onlineTabletsForTable = onlineTablets.get(table);
      try {
        if (onlineTabletsForTable == null) {
          onlineTabletsForTable = new HashMap<KeyExtent,TabletStats>();
          for (TabletStats stat : getOnlineTabletsForTable(tooMuch.server, table))
            onlineTabletsForTable.put(new KeyExtent(stat.extent), stat);
          onlineTablets.put(table, onlineTabletsForTable);
        }
      } catch (Exception ex) {
        log.error("Unable to select a tablet to move", ex);
        return result;
      }
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)