Uploaded image for project: 'Cassandra'
  1. Cassandra
  2. CASSANDRA-13357

A possible NPE in nodetool getendpoints

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Normal
    • Resolution: Won't Fix
    • Fix Version/s: 4.x
    • Component/s: Tool/nodetool
    • Labels:
      None
    • Severity:
      Normal

      Description

      The GetEndpoints.execute method has the following code:

      GetEndpoints.java
             List<InetAddress> endpoints = probe.getEndpoints(ks, table, key);
              for (InetAddress endpoint : endpoints)
              {
                  System.out.println(endpoint.getHostAddress());
              }
      

      This code can throw NPE. A similar bug is fixed in CASSANDRA-8950. The buggy code is

      NodeCmd.java
        List<InetAddress> endpoints = this.probe.getEndpoints(keySpace, cf, key);
      
              for (InetAddress anEndpoint : endpoints)
              {
                 output.println(anEndpoint.getHostAddress());
              }
      

      The fixed code is:

      NodeCmd.java
      try
              {
                  List<InetAddress> endpoints = probe.getEndpoints(keySpace, cf, key);
                  for (InetAddress anEndpoint : endpoints)
                     output.println(anEndpoint.getHostAddress());
              }
              catch (IllegalArgumentException ex)
              {
                  output.println(ex.getMessage());
                  probe.failed();
              }
      

      The GetEndpoints.execute method shall be modified as CASSANDRA-8950 does.

        Attachments

        1. cassandra.patch
          1.0 kB
          Hao Zhong

          Activity

            People

            • Assignee:
              haozhong Hao Zhong
              Reporter:
              haozhong Hao Zhong
              Authors:
              Hao Zhong
              Reviewers:
              Eduard Tudenhoefner, Michael Semb Wever
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: