Program: 107817
Project: 107817
Buggy source:
/** 
 * Reads the data definition from the file.
 * @param config
 * @param output 
 * @param definition
 * @param prefix
 * @param zip
 * @throws IOException
 * @throws SAXException
 */
private void readDefinition(final ModelConfiguration config,final boolean output,final DataDefinition definition,final String prefix,final ZipFile zip) throws IOException, SAXException {
  final ZipEntry entry=zip.getEntry(prefix + "String_Node_Str");
  if (entry == null) {
    return;
  }
  final XMLReader xmlReader=XMLReaderFactory.createXMLReader();
  final InputSource inputSource=new InputSource(new BufferedInputStream(zip.getInputStream(entry)));
  xmlReader.setContentHandler(new XMLHandler(){
    String attr, dtype, atype, ref, min, max, format, locale;
    @Override protected boolean end(    final String uri,    final String localName,    final String qName) throws SAXException {
      if (vocabulary.isDefinition(localName)) {
        return true;
      }
 else       if (vocabulary.isAssigment(localName)) {
        if (attr == null) {
          throw new SAXException(Resources.getMessage("String_Node_Str"));
        }
        if (vocabulary.getVocabularyVersion().equals("String_Node_Str")) {
          if (dtype.equals(DataType.STRING.toString())) {
            definition.setDataType(attr,DataType.STRING);
          }
 else           if (dtype.equals(DataType.DECIMAL.toString())) {
            definition.setDataType(attr,DataType.DECIMAL);
          }
 else {
            definition.setDataType(attr,DataType.createDate(dtype));
          }
        }
 else         if (vocabulary.getVocabularyVersion().equals("String_Node_Str")) {
          DataType<?> datatype=null;
          for (          DataTypeDescription<?> description : DataType.list()) {
            if (description.getLabel().equals(dtype)) {
              if (format != null) {
                if (!description.hasFormat()) {
                  throw new RuntimeException(Resources.getMessage("String_Node_Str"));
                }
                if (locale != null) {
                  Locale lLocale=getLocale(locale);
                  datatype=description.newInstance(format,lLocale);
                }
 else {
                  datatype=description.newInstance(format);
                }
              }
 else {
                if (locale != null) {
                  Locale lLocale=getLocale(locale);
                  datatype=description.newInstance(lLocale);
                }
 else {
                  datatype=description.newInstance();
                }
              }
              break;
            }
          }
          if (datatype == null) {
            throw new RuntimeException(Resources.getMessage("String_Node_Str") + attr);
          }
          definition.setDataType(attr,datatype);
        }
        if (atype.equals(AttributeType.IDENTIFYING_ATTRIBUTE.toString())) {
          definition.setAttributeType(attr,AttributeType.IDENTIFYING_ATTRIBUTE);
        }
 else         if (atype.equals(AttributeType.SENSITIVE_ATTRIBUTE.toString())) {
          definition.setAttributeType(attr,AttributeType.SENSITIVE_ATTRIBUTE);
          if (ref != null) {
            try {
              if (config.getHierarchy(attr) == null) {
                config.setHierarchy(attr,readHierarchy(zip,prefix,ref));
              }
            }
 catch (            final IOException e) {
              throw new SAXException(e);
            }
          }
        }
 else         if (atype.equals(AttributeType.INSENSITIVE_ATTRIBUTE.toString())) {
          definition.setAttributeType(attr,AttributeType.INSENSITIVE_ATTRIBUTE);
        }
 else         if (atype.equals(AttributeType.QUASI_IDENTIFYING_ATTRIBUTE.toString())) {
          definition.setAttributeType(attr,AttributeType.QUASI_IDENTIFYING_ATTRIBUTE);
          if (config.getTransformationMode(attr) == ModelTransformationMode.MICRO_AGGREGATION) {
            MicroAggregationFunction microaggregation=config.getMicroAggregationFunction(attr).createInstance(config.getMicroAggregationIgnoreMissingData(attr));
            definition.setMicroAggregationFunction(attr,microaggregation);
          }
 else           if (config.getTransformationMode(attr) == ModelTransformationMode.CLUSTERING_AND_MICRO_AGGREGATION) {
            MicroAggregationFunction microaggregation=config.getMicroAggregationFunction(attr).createInstance(config.getMicroAggregationIgnoreMissingData(attr));
            definition.setMicroAggregationFunction(attr,microaggregation,true);
          }
          Hierarchy hierarchy=config.getHierarchy(attr);
          if (hierarchy == null) {
            if (ref != null) {
              try {
                if (output && zip.getEntry(prefix + ref) == null) {
                  String[] data=config.getInput().getHandle().getDistinctValues(config.getInput().getHandle().getColumnIndexOf(attr));
                  String[][] array=new String[data.length][];
                  for (int i=0; i < data.length; i++) {
                    array[i]=new String[]{data[i]};
                  }
                  hierarchy=Hierarchy.create(array);
                }
 else {
                  hierarchy=readHierarchy(zip,prefix,ref);
                }
              }
 catch (              final IOException e) {
                throw new SAXException(e);
              }
            }
          }
          if (hierarchy != null && hierarchy.getHierarchy() != null) {
            config.setHierarchy(attr,hierarchy);
            definition.setHierarchy(attr,hierarchy);
            int height=hierarchy.getHierarchy().length > 0 ? hierarchy.getHierarchy()[0].length : 0;
            if (min.equals("String_Node_Str")) {
              config.setMinimumGeneralization(attr,null);
              definition.setMinimumGeneralization(attr,0);
            }
 else {
              config.setMinimumGeneralization(attr,Integer.valueOf(min));
              definition.setMinimumGeneralization(attr,Integer.valueOf(min));
            }
            if (max.equals("String_Node_Str")) {
              config.setMaximumGeneralization(attr,null);
              definition.setMaximumGeneralization(attr,height - 1);
            }
 else {
              config.setMaximumGeneralization(attr,Integer.valueOf(max));
              definition.setMaximumGeneralization(attr,Integer.valueOf(max));
            }
            if (vocabulary.getVocabularyVersion().equals("String_Node_Str")) {
              if (config.getMinimumGeneralization(attr) != null && config.getMinimumGeneralization(attr).equals(0)) {
                config.setMinimumGeneralization(attr,null);
              }
              if (config.getMaximumGeneralization(attr) != null && config.getMaximumGeneralization(attr).equals(height - 1)) {
                config.setMaximumGeneralization(attr,null);
              }
            }
          }
        }
 else {
          throw new SAXException(Resources.getMessage("String_Node_Str"));
        }
        attr=null;
        atype=null;
        dtype=null;
        ref=null;
        min=null;
        max=null;
        format=null;
        locale=null;
        return true;
      }
 else       if (vocabulary.isName(localName)) {
        attr=payload;
        return true;
      }
 else       if (vocabulary.isType(localName)) {
        atype=payload;
        return true;
      }
 else       if (vocabulary.isDatatype(localName)) {
        dtype=payload;
        return true;
      }
 else       if (vocabulary.isFormat(localName)) {
        format=payload;
        return true;
      }
 else       if (vocabulary.isLocale(localName)) {
        locale=payload;
        return true;
      }
 else       if (vocabulary.isRef(localName)) {
        ref=payload;
        return true;
      }
 else       if (vocabulary.isMin(localName)) {
        min=payload;
        return true;
      }
 else       if (vocabulary.isMax(localName)) {
        max=payload;
        return true;
      }
 else       if (vocabulary.isMicroaggregationFunction(localName)) {
        return true;
      }
 else       if (vocabulary.isMicroaggregationIgnoreMissingData(localName)) {
        return true;
      }
 else {
        return false;
      }
    }
    @Override protected boolean start(    final String uri,    final String localName,    final String qName,    final Attributes attributes) throws SAXException {
      if (vocabulary.isDefinition(localName)) {
        return true;
      }
 else       if (vocabulary.isAssigment(localName)) {
        attr=null;
        dtype=null;
        atype=null;
        format=null;
        locale=null;
        ref=null;
        min=null;
        max=null;
        return true;
      }
 else       if (vocabulary.isName(localName) || vocabulary.isType(localName) || vocabulary.isDatatype(localName)|| vocabulary.isFormat(localName)|| vocabulary.isLocale(localName)|| vocabulary.isRef(localName)|| vocabulary.isMin(localName)|| vocabulary.isMax(localName)|| vocabulary.isMicroaggregationFunction(localName)|| vocabulary.isMicroaggregationIgnoreMissingData(localName)) {
        return true;
      }
 else {
        return false;
      }
    }
  }
);
  xmlReader.parse(inputSource);
}

Fixed version (ground truth):
/** 
 * Reads the data definition from the file.
 * @param config
 * @param output 
 * @param definition
 * @param prefix
 * @param zip
 * @throws IOException
 * @throws SAXException
 */
private void readDefinition(final ModelConfiguration config,final boolean output,final DataDefinition definition,final String prefix,final ZipFile zip) throws IOException, SAXException {
  final ZipEntry entry=zip.getEntry(prefix + "String_Node_Str");
  if (entry == null) {
    return;
  }
  final XMLReader xmlReader=XMLReaderFactory.createXMLReader();
  final InputSource inputSource=new InputSource(new BufferedInputStream(zip.getInputStream(entry)));
  xmlReader.setContentHandler(new XMLHandler(){
    String attr, dtype, atype, ref, min, max, format, locale, response;
    @Override protected boolean end(    final String uri,    final String localName,    final String qName) throws SAXException {
      if (vocabulary.isDefinition(localName)) {
        return true;
      }
 else       if (vocabulary.isAssigment(localName)) {
        if (attr == null) {
          throw new SAXException(Resources.getMessage("String_Node_Str"));
        }
        if (vocabulary.getVocabularyVersion().equals("String_Node_Str")) {
          if (dtype.equals(DataType.STRING.toString())) {
            definition.setDataType(attr,DataType.STRING);
          }
 else           if (dtype.equals(DataType.DECIMAL.toString())) {
            definition.setDataType(attr,DataType.DECIMAL);
          }
 else {
            definition.setDataType(attr,DataType.createDate(dtype));
          }
        }
 else         if (vocabulary.getVocabularyVersion().equals("String_Node_Str")) {
          DataType<?> datatype=null;
          for (          DataTypeDescription<?> description : DataType.list()) {
            if (description.getLabel().equals(dtype)) {
              if (format != null) {
                if (!description.hasFormat()) {
                  throw new RuntimeException(Resources.getMessage("String_Node_Str"));
                }
                if (locale != null) {
                  Locale lLocale=getLocale(locale);
                  datatype=description.newInstance(format,lLocale);
                }
 else {
                  datatype=description.newInstance(format);
                }
              }
 else {
                if (locale != null) {
                  Locale lLocale=getLocale(locale);
                  datatype=description.newInstance(lLocale);
                }
 else {
                  datatype=description.newInstance();
                }
              }
              break;
            }
          }
          if (datatype == null) {
            throw new RuntimeException(Resources.getMessage("String_Node_Str") + attr);
          }
          definition.setDataType(attr,datatype);
        }
        if (response != null && response.equals("String_Node_Str")) {
          definition.setResponseVariable(attr,true);
        }
        if (atype.equals(AttributeType.IDENTIFYING_ATTRIBUTE.toString())) {
          definition.setAttributeType(attr,AttributeType.IDENTIFYING_ATTRIBUTE);
        }
 else         if (atype.equals(AttributeType.SENSITIVE_ATTRIBUTE.toString())) {
          definition.setAttributeType(attr,AttributeType.SENSITIVE_ATTRIBUTE);
          if (ref != null) {
            try {
              if (config.getHierarchy(attr) == null) {
                config.setHierarchy(attr,readHierarchy(zip,prefix,ref));
              }
            }
 catch (            final IOException e) {
              throw new SAXException(e);
            }
          }
        }
 else         if (atype.equals(AttributeType.INSENSITIVE_ATTRIBUTE.toString())) {
          definition.setAttributeType(attr,AttributeType.INSENSITIVE_ATTRIBUTE);
        }
 else         if (atype.equals(AttributeType.QUASI_IDENTIFYING_ATTRIBUTE.toString())) {
          definition.setAttributeType(attr,AttributeType.QUASI_IDENTIFYING_ATTRIBUTE);
          if (config.getTransformationMode(attr) == ModelTransformationMode.MICRO_AGGREGATION) {
            MicroAggregationFunction microaggregation=config.getMicroAggregationFunction(attr).createInstance(config.getMicroAggregationIgnoreMissingData(attr));
            definition.setMicroAggregationFunction(attr,microaggregation);
          }
 else           if (config.getTransformationMode(attr) == ModelTransformationMode.CLUSTERING_AND_MICRO_AGGREGATION) {
            MicroAggregationFunction microaggregation=config.getMicroAggregationFunction(attr).createInstance(config.getMicroAggregationIgnoreMissingData(attr));
            definition.setMicroAggregationFunction(attr,microaggregation,true);
          }
          Hierarchy hierarchy=config.getHierarchy(attr);
          if (hierarchy == null) {
            if (ref != null) {
              try {
                if (output && zip.getEntry(prefix + ref) == null) {
                  String[] data=config.getInput().getHandle().getDistinctValues(config.getInput().getHandle().getColumnIndexOf(attr));
                  String[][] array=new String[data.length][];
                  for (int i=0; i < data.length; i++) {
                    array[i]=new String[]{data[i]};
                  }
                  hierarchy=Hierarchy.create(array);
                }
 else {
                  hierarchy=readHierarchy(zip,prefix,ref);
                }
              }
 catch (              final IOException e) {
                throw new SAXException(e);
              }
            }
          }
          if (hierarchy != null && hierarchy.getHierarchy() != null) {
            config.setHierarchy(attr,hierarchy);
            definition.setHierarchy(attr,hierarchy);
            int height=hierarchy.getHierarchy().length > 0 ? hierarchy.getHierarchy()[0].length : 0;
            if (min.equals("String_Node_Str")) {
              config.setMinimumGeneralization(attr,null);
              definition.setMinimumGeneralization(attr,0);
            }
 else {
              config.setMinimumGeneralization(attr,Integer.valueOf(min));
              definition.setMinimumGeneralization(attr,Integer.valueOf(min));
            }
            if (max.equals("String_Node_Str")) {
              config.setMaximumGeneralization(attr,null);
              definition.setMaximumGeneralization(attr,height - 1);
            }
 else {
              config.setMaximumGeneralization(attr,Integer.valueOf(max));
              definition.setMaximumGeneralization(attr,Integer.valueOf(max));
            }
            if (vocabulary.getVocabularyVersion().equals("String_Node_Str")) {
              if (config.getMinimumGeneralization(attr) != null && config.getMinimumGeneralization(attr).equals(0)) {
                config.setMinimumGeneralization(attr,null);
              }
              if (config.getMaximumGeneralization(attr) != null && config.getMaximumGeneralization(attr).equals(height - 1)) {
                config.setMaximumGeneralization(attr,null);
              }
            }
          }
        }
 else {
          throw new SAXException(Resources.getMessage("String_Node_Str"));
        }
        attr=null;
        atype=null;
        dtype=null;
        ref=null;
        min=null;
        max=null;
        format=null;
        locale=null;
        response=null;
        return true;
      }
 else       if (vocabulary.isName(localName)) {
        attr=payload;
        return true;
      }
 else       if (vocabulary.isType(localName)) {
        atype=payload;
        return true;
      }
 else       if (vocabulary.isDatatype(localName)) {
        dtype=payload;
        return true;
      }
 else       if (vocabulary.isFormat(localName)) {
        format=payload;
        return true;
      }
 else       if (vocabulary.isLocale(localName)) {
        locale=payload;
        return true;
      }
 else       if (vocabulary.isResponseVariable(localName)) {
        response=payload;
        return true;
      }
 else       if (vocabulary.isRef(localName)) {
        ref=payload;
        return true;
      }
 else       if (vocabulary.isMin(localName)) {
        min=payload;
        return true;
      }
 else       if (vocabulary.isMax(localName)) {
        max=payload;
        return true;
      }
 else       if (vocabulary.isMicroaggregationFunction(localName)) {
        return true;
      }
 else       if (vocabulary.isMicroaggregationIgnoreMissingData(localName)) {
        return true;
      }
 else {
        return false;
      }
    }
    @Override protected boolean start(    final String uri,    final String localName,    final String qName,    final Attributes attributes) throws SAXException {
      if (vocabulary.isDefinition(localName)) {
        return true;
      }
 else       if (vocabulary.isAssigment(localName)) {
        attr=null;
        dtype=null;
        atype=null;
        format=null;
        locale=null;
        ref=null;
        min=null;
        max=null;
        response=null;
        return true;
      }
 else       if (vocabulary.isName(localName) || vocabulary.isType(localName) || vocabulary.isDatatype(localName)|| vocabulary.isFormat(localName)|| vocabulary.isLocale(localName)|| vocabulary.isRef(localName)|| vocabulary.isResponseVariable(localName)|| vocabulary.isMin(localName)|| vocabulary.isMax(localName)|| vocabulary.isMicroaggregationFunction(localName)|| vocabulary.isMicroaggregationIgnoreMissingData(localName)) {
        return true;
      }
 else {
        return false;
      }
    }
  }
);
  xmlReader.parse(inputSource);
}