Program: 108668
Project: 108668
Buggy source:
public void createCriteriaAndDefinition(ModelConfiguration config){
  config.removeAllCriteria();
  for (  String attr : config.getInput().getDefinition().getQuasiIdentifyingAttributes()) {
    Hierarchy hierarchy=config.getHierarchy(attr);
    Integer min=config.getMinimumGeneralization(attr);
    Integer max=config.getMaximumGeneralization(attr);
    if (min == null) {
      min=0;
    }
    if (max == null) {
      if (hierarchy.getHierarchy().length == 0) {
        max=0;
      }
 else {
        max=hierarchy.getHierarchy()[0].length - 1;
      }
    }
    config.getInput().getDefinition().setAttributeType(attr,hierarchy);
    config.getInput().getDefinition().setMinimumGeneralization(attr,min);
    config.getInput().getDefinition().setMaximumGeneralization(attr,max);
  }
  if (this.kAnonymityModel != null && this.kAnonymityModel.isActive() && this.kAnonymityModel.isEnabled()) {
    config.addCriterion(this.kAnonymityModel.getCriterion(this));
  }
  if (this.dPresenceModel != null && this.dPresenceModel.isActive() && this.dPresenceModel.isEnabled()) {
    config.addCriterion(this.dPresenceModel.getCriterion(this));
  }
  for (  Entry<String,ModelLDiversityCriterion> entry : this.lDiversityModel.entrySet()) {
    if (entry.getValue() != null && entry.getValue().isActive() && entry.getValue().isEnabled()) {
      config.addCriterion(entry.getValue().getCriterion(this));
    }
  }
  for (  Entry<String,ModelTClosenessCriterion> entry : this.tClosenessModel.entrySet()) {
    if (entry.getValue() != null && entry.getValue().isActive() && entry.getValue().isEnabled()) {
      config.addCriterion(entry.getValue().getCriterion(this));
    }
  }
  if (!config.containsCriterion(DPresence.class)) {
    if (getInputConfig() != null && getInputConfig().getInput() != null && getInputConfig().getResearchSubset() != null) {
      DataSubset subset=DataSubset.create(getInputConfig().getInput(),getInputConfig().getResearchSubset());
      config.addCriterion(new Inclusion(subset));
    }
  }
}

Fixed version (ground truth):
public void createCriteriaAndDefinition(ModelConfiguration config){
  config.removeAllCriteria();
  for (  String attr : config.getInput().getDefinition().getQuasiIdentifyingAttributes()) {
    Hierarchy hierarchy=config.getHierarchy(attr);
    if (hierarchy == null || hierarchy.getHierarchy() == null) {
      hierarchy=Hierarchy.create();
      config.setHierarchy(attr,hierarchy);
    }
    Integer min=config.getMinimumGeneralization(attr);
    Integer max=config.getMaximumGeneralization(attr);
    if (min == null) {
      min=0;
    }
    if (max == null) {
      if (hierarchy.getHierarchy().length == 0) {
        max=0;
      }
 else {
        max=hierarchy.getHierarchy()[0].length - 1;
      }
    }
    config.getInput().getDefinition().setAttributeType(attr,hierarchy);
    config.getInput().getDefinition().setMinimumGeneralization(attr,min);
    config.getInput().getDefinition().setMaximumGeneralization(attr,max);
  }
  if (this.kAnonymityModel != null && this.kAnonymityModel.isActive() && this.kAnonymityModel.isEnabled()) {
    config.addCriterion(this.kAnonymityModel.getCriterion(this));
  }
  if (this.dPresenceModel != null && this.dPresenceModel.isActive() && this.dPresenceModel.isEnabled()) {
    config.addCriterion(this.dPresenceModel.getCriterion(this));
  }
  for (  Entry<String,ModelLDiversityCriterion> entry : this.lDiversityModel.entrySet()) {
    if (entry.getValue() != null && entry.getValue().isActive() && entry.getValue().isEnabled()) {
      config.addCriterion(entry.getValue().getCriterion(this));
    }
  }
  for (  Entry<String,ModelTClosenessCriterion> entry : this.tClosenessModel.entrySet()) {
    if (entry.getValue() != null && entry.getValue().isActive() && entry.getValue().isEnabled()) {
      if (entry.getValue().getVariant() == 1) {
        if (config.getHierarchy(entry.getValue().getAttribute()) == null) {
          config.setHierarchy(entry.getValue().getAttribute(),Hierarchy.create());
        }
      }
      PrivacyCriterion criterion=entry.getValue().getCriterion(this);
      config.addCriterion(criterion);
    }
  }
  if (!config.containsCriterion(DPresence.class)) {
    if (getInputConfig() != null && getInputConfig().getInput() != null && getInputConfig().getResearchSubset() != null) {
      DataSubset subset=DataSubset.create(getInputConfig().getInput(),getInputConfig().getResearchSubset());
      config.addCriterion(new Inclusion(subset));
    }
  }
}