Program: 166361
Project: 166361
Buggy source:
public VXResource mapPublicToXAObject(VXPolicy vXPolicy,int operationContext){
  VXResource vXResource=new VXResource();
  vXResource=super.mapBaseAttributesToXAObject(vXPolicy,vXResource);
  vXResource.setName(vXPolicy.getResourceName());
  vXResource.setPolicyName(vXPolicy.getPolicyName());
  vXResource.setDescription(vXPolicy.getDescription());
  vXResource.setResourceType(getResourceType(vXPolicy));
  XXAsset xAsset=xaDaoMgr.getXXAsset().findByAssetName(vXPolicy.getRepositoryName());
  if (xAsset == null) {
    throw restErrorUtil.createRESTException("String_Node_Str" + "String_Node_Str",MessageEnums.INVALID_INPUT_DATA);
  }
  vXResource.setAssetId(xAsset.getId());
  if (operationContext == AbstractBaseResourceService.OPERATION_UPDATE_CONTEXT) {
    XXResource xxResource=xaDaoMgr.getXXResource().getById(vXPolicy.getId());
    if (xxResource == null) {
      logger.error("String_Node_Str" + vXPolicy.getId());
      throw restErrorUtil.createRESTException("String_Node_Str" + vXResource.getId(),MessageEnums.DATA_NOT_FOUND);
    }
    xxResource.setUpdateTime(DateUtil.getUTCDate());
    xResourceService.mapBaseAttributesToViewBean(xxResource,vXResource);
    SearchCriteria scAuditMap=new SearchCriteria();
    scAuditMap.addParam("String_Node_Str",xxResource.getId());
    VXAuditMapList vXAuditMapList=xAuditMapService.searchXAuditMaps(scAuditMap);
    List<VXAuditMap> auditList=new ArrayList<VXAuditMap>();
    if (vXAuditMapList.getListSize() > 0 && vXPolicy.getIsAuditEnabled()) {
      auditList.addAll(vXAuditMapList.getVXAuditMaps());
    }
 else     if (vXAuditMapList.getListSize() == 0 && vXPolicy.getIsAuditEnabled()) {
      VXAuditMap vXAuditMap=new VXAuditMap();
      vXAuditMap.setAuditType(AppConstants.XA_AUDIT_TYPE_ALL);
      auditList.add(vXAuditMap);
    }
    List<VXPermMap> permMapList=mapPermObjToPermList(vXPolicy.getPermMapList(),vXPolicy);
    vXResource.setAuditList(auditList);
    vXResource.setPermMapList(permMapList);
  }
 else   if (operationContext == AbstractBaseResourceService.OPERATION_CREATE_CONTEXT) {
    if (vXPolicy.getIsAuditEnabled()) {
      VXAuditMap vXAuditMap=new VXAuditMap();
      vXAuditMap.setAuditType(AppConstants.XA_AUDIT_TYPE_ALL);
      List<VXAuditMap> auditList=new ArrayList<VXAuditMap>();
      auditList.add(vXAuditMap);
      vXResource.setAuditList(auditList);
    }
    if (!stringUtil.isEmpty(vXPolicy.getPermMapList())) {
      List<VXPermMap> permMapList=mapPermObjToPermList(vXPolicy.getPermMapList());
      vXResource.setPermMapList(permMapList);
    }
  }
  vXResource.setDatabases(vXPolicy.getDatabases());
  vXResource.setTables(vXPolicy.getTables());
  vXResource.setColumnFamilies(vXPolicy.getColumnFamilies());
  vXResource.setColumns(vXPolicy.getColumns());
  vXResource.setUdfs(vXPolicy.getUdfs());
  vXResource.setAssetName(vXPolicy.getRepositoryName());
  int assetType=AppConstants.getEnumFor_AssetType(vXPolicy.getRepositoryType());
  if (assetType == 0 || assetType == AppConstants.ASSET_UNKNOWN) {
    assetType=xAsset.getAssetType();
    vXPolicy.setRepositoryType(AppConstants.getLabelFor_AssetType(assetType));
  }
  vXResource.setAssetType(assetType);
  int resourceStatus=AppConstants.STATUS_ENABLED;
  if (!vXPolicy.getIsEnabled()) {
    resourceStatus=AppConstants.STATUS_DISABLED;
  }
  vXResource.setResourceStatus(resourceStatus);
  vXResource.setCheckParentPermission(AppConstants.BOOL_FALSE);
  vXResource.setTopologies(vXPolicy.getTopologies());
  vXResource.setServices(vXPolicy.getServices());
  if (vXPolicy.getRepositoryType().equalsIgnoreCase(AppConstants.getLabelFor_AssetType(AppConstants.ASSET_HIVE))) {
    vXResource.setTableType(AppConstants.getEnumFor_PolicyType(vXPolicy.getTableType()));
    vXResource.setColumnType(AppConstants.getEnumFor_PolicyType(vXPolicy.getColumnType()));
  }
  if (vXPolicy.getRepositoryType().equalsIgnoreCase(AppConstants.getLabelFor_AssetType(AppConstants.ASSET_HDFS))) {
    vXResource.setIsRecursive(AppConstants.getEnumFor_BooleanValue(vXPolicy.getIsRecursive()));
  }
  return vXResource;
}

Fixed version (ground truth):
public VXResource mapPublicToXAObject(VXPolicy vXPolicy,int operationContext){
  VXResource vXResource=new VXResource();
  vXResource=super.mapBaseAttributesToXAObject(vXPolicy,vXResource);
  vXResource.setName(vXPolicy.getResourceName());
  vXResource.setPolicyName(vXPolicy.getPolicyName());
  vXResource.setDescription(vXPolicy.getDescription());
  vXResource.setResourceType(getResourceType(vXPolicy));
  XXAsset xAsset=xaDaoMgr.getXXAsset().findByAssetName(vXPolicy.getRepositoryName());
  if (xAsset == null) {
    throw restErrorUtil.createRESTException("String_Node_Str" + "String_Node_Str",MessageEnums.INVALID_INPUT_DATA);
  }
  vXResource.setAssetId(xAsset.getId());
  if (operationContext == AbstractBaseResourceService.OPERATION_UPDATE_CONTEXT) {
    XXResource xxResource=xaDaoMgr.getXXResource().getById(vXPolicy.getId());
    if (xxResource == null) {
      logger.error("String_Node_Str" + vXPolicy.getId());
      throw restErrorUtil.createRESTException("String_Node_Str" + vXResource.getId(),MessageEnums.DATA_NOT_FOUND);
    }
    xxResource.setUpdateTime(DateUtil.getUTCDate());
    xResourceService.mapBaseAttributesToViewBean(xxResource,vXResource);
    SearchCriteria scAuditMap=new SearchCriteria();
    scAuditMap.addParam("String_Node_Str",xxResource.getId());
    VXAuditMapList vXAuditMapList=xAuditMapService.searchXAuditMaps(scAuditMap);
    List<VXAuditMap> auditList=new ArrayList<VXAuditMap>();
    if (vXAuditMapList.getListSize() > 0 && vXPolicy.getIsAuditEnabled()) {
      auditList.addAll(vXAuditMapList.getVXAuditMaps());
    }
 else     if (vXAuditMapList.getListSize() == 0 && vXPolicy.getIsAuditEnabled()) {
      VXAuditMap vXAuditMap=new VXAuditMap();
      vXAuditMap.setAuditType(AppConstants.XA_AUDIT_TYPE_ALL);
      auditList.add(vXAuditMap);
    }
    List<VXPermMap> permMapList=mapPermObjToPermList(vXPolicy.getPermMapList(),vXPolicy);
    vXResource.setAuditList(auditList);
    vXResource.setPermMapList(permMapList);
  }
 else   if (operationContext == AbstractBaseResourceService.OPERATION_CREATE_CONTEXT) {
    if (vXPolicy.getIsAuditEnabled()) {
      VXAuditMap vXAuditMap=new VXAuditMap();
      vXAuditMap.setAuditType(AppConstants.XA_AUDIT_TYPE_ALL);
      List<VXAuditMap> auditList=new ArrayList<VXAuditMap>();
      auditList.add(vXAuditMap);
      vXResource.setAuditList(auditList);
    }
    if (!stringUtil.isEmpty(vXPolicy.getPermMapList())) {
      List<VXPermMap> permMapList=mapPermObjToPermList(vXPolicy.getPermMapList());
      vXResource.setPermMapList(permMapList);
    }
  }
  vXResource.setDatabases(vXPolicy.getDatabases());
  vXResource.setTables(vXPolicy.getTables());
  vXResource.setColumnFamilies(vXPolicy.getColumnFamilies());
  vXResource.setColumns(vXPolicy.getColumns());
  vXResource.setUdfs(vXPolicy.getUdfs());
  vXResource.setAssetName(vXPolicy.getRepositoryName());
  int assetType=AppConstants.getEnumFor_AssetType(vXPolicy.getRepositoryType());
  if (assetType == AppConstants.ASSET_UNKNOWN) {
    assetType=xAsset.getAssetType();
    vXPolicy.setRepositoryType(AppConstants.getLabelFor_AssetType(assetType));
  }
  vXResource.setAssetType(assetType);
  int resourceStatus=AppConstants.STATUS_ENABLED;
  if (!vXPolicy.getIsEnabled()) {
    resourceStatus=AppConstants.STATUS_DISABLED;
  }
  vXResource.setResourceStatus(resourceStatus);
  vXResource.setCheckParentPermission(AppConstants.BOOL_FALSE);
  vXResource.setTopologies(vXPolicy.getTopologies());
  vXResource.setServices(vXPolicy.getServices());
  if (vXPolicy.getRepositoryType().equalsIgnoreCase(AppConstants.getLabelFor_AssetType(AppConstants.ASSET_HIVE))) {
    vXResource.setTableType(AppConstants.getEnumFor_PolicyType(vXPolicy.getTableType()));
    vXResource.setColumnType(AppConstants.getEnumFor_PolicyType(vXPolicy.getColumnType()));
  }
  if (vXPolicy.getRepositoryType().equalsIgnoreCase(AppConstants.getLabelFor_AssetType(AppConstants.ASSET_HDFS))) {
    vXResource.setIsRecursive(AppConstants.getEnumFor_BooleanValue(vXPolicy.getIsRecursive()));
  }
  return vXResource;
}