Program: 48616
Project: 48616
Buggy source:
@SuppressWarnings("String_Node_Str") private void convertClusterConfig(ClusterEntity clusterEntity,ClusterCreate clusterConfig,boolean needAllocIp){
  logger.debug("String_Node_Str" + clusterEntity.getName());
  CommonClusterExpandPolicy.expandDistro(clusterEntity,clusterConfig,distroMgr);
  clusterConfig.setDistroVendor(clusterEntity.getDistroVendor());
  clusterConfig.setDistroVersion(clusterEntity.getDistroVersion());
  clusterConfig.setAppManager(clusterEntity.getAppManager());
  clusterConfig.setHttpProxy(httpProxy);
  clusterConfig.setNoProxy(noProxy);
  clusterConfig.setTopologyPolicy(clusterEntity.getTopologyPolicy());
  clusterConfig.setPassword(clusterEntity.getPassword());
  Map<String,String> hostToRackMap=rackInfoMgr.exportHostRackMap();
  if ((clusterConfig.getTopologyPolicy() == TopologyType.RACK_AS_RACK || clusterConfig.getTopologyPolicy() == TopologyType.HVE) && hostToRackMap.isEmpty()) {
    logger.error("String_Node_Str");
    throw ClusterConfigException.INVALID_TOPOLOGY_POLICY(clusterConfig.getTopologyPolicy(),"String_Node_Str");
  }
  clusterConfig.setHostToRackMap(hostToRackMap);
  clusterConfig.setTemplateId(templateId);
  if (clusterEntity.getVcRpNames() != null) {
    logger.debug("String_Node_Str");
    String[] rpNames=clusterEntity.getVcRpNameList().toArray(new String[clusterEntity.getVcRpNameList().size()]);
    List<VcCluster> vcClusters=rpMgr.getVcResourcePoolByNameList(rpNames);
    clusterConfig.setVcClusters(vcClusters);
    clusterConfig.setRpNames(clusterEntity.getVcRpNameList());
  }
 else {
    clusterConfig.setVcClusters(rpMgr.getAllVcResourcePool());
    logger.debug("String_Node_Str");
  }
  if (clusterEntity.getVcDatastoreNameList() != null) {
    logger.debug("String_Node_Str");
    Set<String> sharedPattern=datastoreMgr.getSharedDatastoresByNames(clusterEntity.getVcDatastoreNameList());
    clusterConfig.setSharedDatastorePattern(sharedPattern);
    Set<String> localPattern=datastoreMgr.getLocalDatastoresByNames(clusterEntity.getVcDatastoreNameList());
    clusterConfig.setLocalDatastorePattern(localPattern);
    clusterConfig.setDsNames(clusterEntity.getVcDatastoreNameList());
  }
 else {
    clusterConfig.setSharedDatastorePattern(datastoreMgr.getAllSharedDatastores());
    clusterConfig.setLocalDatastorePattern(datastoreMgr.getAllLocalDatastores());
    logger.debug("String_Node_Str");
  }
  List<NodeGroupCreate> nodeGroups=new ArrayList<NodeGroupCreate>();
  Set<NodeGroupEntity> nodeGroupEntities=clusterEntity.getNodeGroups();
  long instanceNum=0;
  for (  NodeGroupEntity ngEntity : nodeGroupEntities) {
    NodeGroupCreate group=convertNodeGroups(clusterEntity,ngEntity,clusterEntity.getName());
    nodeGroups.add(group);
    instanceNum+=group.getInstanceNum();
  }
  if (clusterEntity.getAppManager() == null) {
    sortGroups(nodeGroups);
  }
  clusterConfig.setNodeGroups(nodeGroups.toArray(new NodeGroupCreate[nodeGroups.size()]));
  List<String> networkNames=clusterEntity.fetchNetworkNameList();
  List<NetworkAdd> networkingAdds=allocatNetworkIp(networkNames,clusterEntity,instanceNum,needAllocIp);
  clusterConfig.setNetworkings(networkingAdds);
  clusterConfig.setNetworkConfig(convertNetConfigsToNetNames(clusterEntity.getNetworkConfigInfo()));
  if (clusterEntity.getHadoopConfig() != null) {
    Map<String,Object> hadoopConfig=(new Gson()).fromJson(clusterEntity.getHadoopConfig(),Map.class);
    clusterConfig.setConfiguration(hadoopConfig);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") private void convertClusterConfig(ClusterEntity clusterEntity,ClusterCreate clusterConfig,boolean needAllocIp){
  logger.debug("String_Node_Str" + clusterEntity.getName());
  CommonClusterExpandPolicy.expandDistro(clusterEntity,clusterConfig,distroMgr);
  clusterConfig.setDistroVendor(clusterEntity.getDistroVendor());
  clusterConfig.setDistroVersion(clusterEntity.getDistroVersion());
  clusterConfig.setAppManager(clusterEntity.getAppManager());
  clusterConfig.setHttpProxy(httpProxy);
  clusterConfig.setNoProxy(noProxy);
  clusterConfig.setTopologyPolicy(clusterEntity.getTopologyPolicy());
  clusterConfig.setPassword(clusterEntity.getPassword());
  Map<String,String> hostToRackMap=rackInfoMgr.exportHostRackMap();
  if ((clusterConfig.getTopologyPolicy() == TopologyType.RACK_AS_RACK || clusterConfig.getTopologyPolicy() == TopologyType.HVE) && hostToRackMap.isEmpty()) {
    logger.error("String_Node_Str");
    throw ClusterConfigException.INVALID_TOPOLOGY_POLICY(clusterConfig.getTopologyPolicy(),"String_Node_Str");
  }
  clusterConfig.setHostToRackMap(hostToRackMap);
  clusterConfig.setTemplateId(templateId);
  if (clusterEntity.getVcRpNames() != null) {
    logger.debug("String_Node_Str");
    String[] rpNames=clusterEntity.getVcRpNameList().toArray(new String[clusterEntity.getVcRpNameList().size()]);
    List<VcCluster> vcClusters=rpMgr.getVcResourcePoolByNameList(rpNames);
    clusterConfig.setVcClusters(vcClusters);
    clusterConfig.setRpNames(clusterEntity.getVcRpNameList());
  }
 else {
    clusterConfig.setVcClusters(rpMgr.getAllVcResourcePool());
    logger.debug("String_Node_Str");
  }
  if (clusterEntity.getVcDatastoreNameList() != null) {
    logger.debug("String_Node_Str");
    Set<String> sharedPattern=datastoreMgr.getSharedDatastoresByNames(clusterEntity.getVcDatastoreNameList());
    clusterConfig.setSharedDatastorePattern(sharedPattern);
    Set<String> localPattern=datastoreMgr.getLocalDatastoresByNames(clusterEntity.getVcDatastoreNameList());
    clusterConfig.setLocalDatastorePattern(localPattern);
    clusterConfig.setDsNames(clusterEntity.getVcDatastoreNameList());
  }
 else {
    clusterConfig.setSharedDatastorePattern(datastoreMgr.getAllSharedDatastores());
    clusterConfig.setLocalDatastorePattern(datastoreMgr.getAllLocalDatastores());
    logger.debug("String_Node_Str");
  }
  List<NodeGroupCreate> nodeGroups=new ArrayList<NodeGroupCreate>();
  Set<NodeGroupEntity> nodeGroupEntities=clusterEntity.getNodeGroups();
  long instanceNum=0;
  for (  NodeGroupEntity ngEntity : nodeGroupEntities) {
    NodeGroupCreate group=convertNodeGroups(clusterEntity,ngEntity,clusterEntity.getName());
    nodeGroups.add(group);
    instanceNum+=group.getInstanceNum();
  }
  if (clusterEntity.getAppManager() == null || Constants.IRONFAN.equalsIgnoreCase(clusterEntity.getAppManager())) {
    sortGroups(nodeGroups);
  }
  clusterConfig.setNodeGroups(nodeGroups.toArray(new NodeGroupCreate[nodeGroups.size()]));
  List<String> networkNames=clusterEntity.fetchNetworkNameList();
  List<NetworkAdd> networkingAdds=allocatNetworkIp(networkNames,clusterEntity,instanceNum,needAllocIp);
  clusterConfig.setNetworkings(networkingAdds);
  clusterConfig.setNetworkConfig(convertNetConfigsToNetNames(clusterEntity.getNetworkConfigInfo()));
  if (clusterEntity.getHadoopConfig() != null) {
    Map<String,Object> hadoopConfig=(new Gson()).fromJson(clusterEntity.getHadoopConfig(),Map.class);
    clusterConfig.setConfiguration(hadoopConfig);
  }
}