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

A possible NPE in nodetool getendpoints

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Normal
    • Resolution: Won't Fix
    • 4.1-alpha1, 4.1
    • Tool/nodetool
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: