Program: 48659
Project: 48659
Buggy source:
private void updateVhmMasterMoid(String clusterName){
  ClusterEntity cluster=getClusterEntityMgr().findByName(clusterName);
  if (cluster.getVhmMasterMoid() == null) {
    List<NodeEntity> nodes=getClusterEntityMgr().findAllNodes(clusterName);
    for (    NodeEntity node : nodes) {
      if (node.getMoId() != null && node.getNodeGroup().getRoles() != null) {
        @SuppressWarnings("String_Node_Str") List<String> roles=new Gson().fromJson(node.getNodeGroup().getRoles(),List.class);
        if (cluster.getDistro().equalsIgnoreCase(Constants.MAPR_VENDOR)) {
          if (roles.contains(HadoopRole.MAPR_JOBTRACKER_ROLE.toString())) {
            String thisJtIp=node.getPrimaryMgtIpV4();
            String activeJtIp;
            try {
              activeJtIp=getMaprActiveJobTrackerIp(thisJtIp,clusterName);
              logger.info("String_Node_Str" + activeJtIp);
            }
 catch (            Exception e) {
              continue;
            }
            AuAssert.check(!CommonUtil.isBlank(thisJtIp),"String_Node_Str");
            for (            NodeEntity jt : nodes) {
              boolean isActiveJt=false;
              for (              NicEntity nicEntity : jt.getNics()) {
                if (nicEntity.getIpv4Address() != null && activeJtIp.equals(nicEntity.getIpv4Address())) {
                  isActiveJt=true;
                  break;
                }
              }
              if (isActiveJt) {
                cluster.setVhmMasterMoid(jt.getMoId());
                break;
              }
            }
            break;
          }
        }
 else {
          if (roles.contains(HadoopRole.HADOOP_JOBTRACKER_ROLE.toString())) {
            cluster.setVhmMasterMoid(node.getMoId());
            break;
          }
        }
      }
    }
  }
  getClusterEntityMgr().update(cluster);
}

Fixed version (ground truth):
private void updateVhmMasterMoid(String clusterName){
  ClusterEntity cluster=getClusterEntityMgr().findByName(clusterName);
  if (cluster.getVhmMasterMoid() == null) {
    List<NodeEntity> nodes=getClusterEntityMgr().findAllNodes(clusterName);
    for (    NodeEntity node : nodes) {
      if (node.getMoId() != null && node.getNodeGroup().getRoles() != null) {
        @SuppressWarnings("String_Node_Str") List<String> roles=new Gson().fromJson(node.getNodeGroup().getRoles(),List.class);
        if (cluster.getDistroVendor().equalsIgnoreCase(Constants.MAPR_VENDOR)) {
          if (roles.contains(HadoopRole.MAPR_JOBTRACKER_ROLE.toString())) {
            String thisJtIp=node.getPrimaryMgtIpV4();
            String activeJtIp;
            try {
              activeJtIp=getMaprActiveJobTrackerIp(thisJtIp,clusterName);
              logger.info("String_Node_Str" + activeJtIp);
            }
 catch (            Exception e) {
              continue;
            }
            AuAssert.check(!CommonUtil.isBlank(thisJtIp),"String_Node_Str");
            for (            NodeEntity jt : nodes) {
              boolean isActiveJt=false;
              for (              NicEntity nicEntity : jt.getNics()) {
                if (nicEntity.getIpv4Address() != null && activeJtIp.equals(nicEntity.getIpv4Address())) {
                  isActiveJt=true;
                  break;
                }
              }
              if (isActiveJt) {
                cluster.setVhmMasterMoid(jt.getMoId());
                break;
              }
            }
            break;
          }
        }
 else {
          if (roles.contains(HadoopRole.HADOOP_JOBTRACKER_ROLE.toString())) {
            cluster.setVhmMasterMoid(node.getMoId());
            break;
          }
        }
      }
    }
  }
  getClusterEntityMgr().update(cluster);
}