accumulo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Josh Elser (JIRA)" <j...@apache.org>
Subject [jira] [Created] (ACCUMULO-3223) DefaultLoadBalancer allows a NPE just to catch it
Date Fri, 10 Oct 2014 19:16:34 GMT
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)

Mime
View raw message