Uploaded image for project: 'Ranger'
  1. Ranger
  2. RANGER-1859

Fix new findBugs in HdfsClient.java

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 1.0.0
    • Fix Version/s: 1.0.0, master
    • Component/s: admin
    • Labels:
    • Flags:
      Patch, Important

      Description

      There is FindBugs: Performance (FB.SBSC_USE_STRINGBUFFER_CONCATENATION) in org.apache.ranger.services.hdfs.client.HdfsClient.validateConnectionConfigs(Map<String, String>)

      if (fsDefaultNameElements != null && fsDefaultNameElements.length >= 2) {
      	String cluster = "";
      	StringBuffer clusters = new StringBuffer();
      	configs.put("dfs.nameservices", "hdfscluster");
      	configs.put("fs.default.name", "hdfs://" + configs.get("dfs.nameservices"));
      	configs.put("dfs.client.failover.proxy.provider." + configs.get("dfs.nameservices"),
      			"org.apache.hadoop.hdfs.server.namenode.ha.ConfiguredFailoverProxyProvider");
      	for (int i = 0; i < fsDefaultNameElements.length; i++) {
      		cluster = "namenode" + (i + 1);
      		configs.put("dfs.namenode.rpc-address." + configs.get("dfs.nameservices") + "." + cluster,
      				fsDefaultNameElements[i]);
      		if (i == (fsDefaultNameElements.length - 1)) {
      				clusters.append(cluster);
      		} else {
      				clusters.append(cluster).append(",");
      		}
      	}
      	configs.put("dfs.ha.namenodes." + configs.get("dfs.nameservices"), clusters.toString());
      }
      

      To view the defects in Coverity Scan visit, https://u2389337.ct.sendgrid.net/wf/click?upn=08onrYu34A-2BWcWUl-2F-2BfV0V05UPxvVjWch-2Bd2MGckcRZSbhom32dlDl11LWEm9nX11zsOWMf5dv3Q9Mogo-2FGua3FsLRTFft2V-2FOFC9o0P2e0-3D_d04ZgyDzSjlwpjXIuOFYDNE6R93Lal83MDClQK32PZtwvLNyXEpALHHKXqGKvroU5mWNsNiM7OVRdsl6DJR5LTUChq42fVbU-2Fr1jlwSSZ3yR3k4ycwZTS0QkKayVUGYhpHjV8vMdPHJwfZIZjeDvW59RoGHYuxr3UvsJzGHNk6gAvr6OuaH0vx6ZtLRw-2F0NLST5sMrn2kXHvdALOtTEjnQ-3D-3D

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                zhangqiang2 Qiang Zhang
                Reporter:
                zhangqiang2 Qiang Zhang
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: