Uploaded image for project: 'Accumulo'
  1. Accumulo
  2. ACCUMULO-3219 Review Coverity
  3. ACCUMULO-3223

DefaultLoadBalancer allows a NPE just to catch it

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 1.5.2, 1.6.1
    • 1.5.3, 1.6.2, 1.7.0
    • master
    • None

    Description

      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.

      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;
            }
      

      Attachments

        Activity

          People

            elserj Josh Elser
            elserj Josh Elser
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 0.5h
                0.5h