Program: 108113
Project: 108113
Buggy source:
/** 
 * Reads the data definition from the file.
 * @param config
 * @param definition
 * @param prefix
 * @param zip
 * @throws IOException
 * @throws SAXException
 */
private void readDefinition(final ModelConfiguration config,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;
    @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"));
                }
                datatype=description.newInstance(format);
              }
 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())) {
          if (config.getTransformationMode(attr) == ModelTransformationMode.MICRO_AGGREGATION) {
            MicroAggregationFunction microaggregation=config.getMicroAggregationFunction(attr).createInstance(config.getMicroAggregationIgnoreMissingData(attr));
            definition.setAttributeType(attr,microaggregation);
          }
 else {
            Hierarchy hierarchy=config.getHierarchy(attr);
            if (hierarchy == null) {
              try {
                hierarchy=readHierarchy(zip,prefix,ref);
              }
 catch (              final IOException e) {
                throw new SAXException(e);
              }
            }
            definition.setAttributeType(attr,hierarchy);
            config.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;
        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.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 {
        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;
        ref=null;
        min=null;
        max=null;
        return true;
      }
 else       if (vocabulary.isName(localName) || vocabulary.isType(localName) || vocabulary.isDatatype(localName)|| vocabulary.isFormat(localName)|| vocabulary.isRef(localName)|| vocabulary.isMin(localName)|| vocabulary.isMax(localName)|| vocabulary.isMicroaggregationFunction(localName)) {
        return true;
      }
 else {
        return false;
      }
    }
  }
);
  xmlReader.parse(inputSource);
}

Fixed version (ground truth):
/** 
 * Reads the data definition from the file.
 * @param config
 * @param definition
 * @param prefix
 * @param zip
 * @throws IOException
 * @throws SAXException
 */
private void readDefinition(final ModelConfiguration config,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;
    @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"));
                }
                datatype=description.newInstance(format);
              }
 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);
          }
          Hierarchy hierarchy=config.getHierarchy(attr);
          if (hierarchy == null) {
            if (ref != null) {
              try {
                hierarchy=readHierarchy(zip,prefix,ref);
              }
 catch (              final IOException e) {
                throw new SAXException(e);
              }
            }
          }
          if (hierarchy != 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;
        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.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;
        ref=null;
        min=null;
        max=null;
        return true;
      }
 else       if (vocabulary.isName(localName) || vocabulary.isType(localName) || vocabulary.isDatatype(localName)|| vocabulary.isFormat(localName)|| vocabulary.isRef(localName)|| vocabulary.isMin(localName)|| vocabulary.isMax(localName)|| vocabulary.isMicroaggregationFunction(localName)|| vocabulary.isMicroaggregationIgnoreMissingData(localName)) {
        return true;
      }
 else {
        return false;
      }
    }
  }
);
  xmlReader.parse(inputSource);
}