Program: 100820
Project: 100820
Buggy source:
/** 
 * Parse the input attributes for needed information.
 */
private void parseAttribute(final Attributes atts,final String attrName) throws SAXException {
  String attrValue=atts.getValue(attrName);
  String filename=null;
  final String attrClass=atts.getValue(ATTRIBUTE_NAME_CLASS);
  final String attrScope=atts.getValue(ATTRIBUTE_NAME_SCOPE);
  final String attrFormat=atts.getValue(ATTRIBUTE_NAME_FORMAT);
  final String attrType=atts.getValue(ATTRIBUTE_NAME_TYPE);
  final String codebase=atts.getValue(ATTRIBUTE_NAME_CODEBASE);
  if (attrValue == null) {
    return;
  }
  if (ATTRIBUTE_NAME_CONREF.equals(attrName) || ATTRIBUTE_NAME_CONKEYREF.equals(attrName)) {
    hasConRef=true;
  }
 else   if (ATTRIBUTE_NAME_HREF.equals(attrName)) {
    if (attrClass != null && PR_D_CODEREF.matches(attrClass)) {
      hasCodeRef=true;
    }
 else {
      hasHref=true;
    }
  }
 else   if (ATTRIBUTE_NAME_KEYREF.equals(attrName)) {
    hasKeyRef=true;
  }
  if (ATTRIBUTE_NAME_KEYS.equals(attrName) && attrValue.length() != 0) {
    String target=atts.getValue(ATTRIBUTE_NAME_HREF);
    final String keyRef=atts.getValue(ATTRIBUTE_NAME_KEYREF);
    final String copy_to=atts.getValue(ATTRIBUTE_NAME_COPY_TO);
    if (!StringUtils.isEmptyString(copy_to)) {
      target=copy_to;
    }
    if (target == null) {
      target="String_Node_Str";
    }
    final String temp=target;
    for (    final String key : attrValue.split("String_Node_Str")) {
      if (!keysDefMap.containsKey(key) && !key.equals("String_Node_Str")) {
        if (target != null && target.length() != 0) {
          if (attrScope != null && (attrScope.equals("String_Node_Str") || attrScope.equals("String_Node_Str"))) {
            exKeysDefMap.put(key,target);
            keysDefMap.put(key,new KeyDef(key,target,null));
          }
 else {
            String tail="String_Node_Str";
            if (target.indexOf(SHARP) != -1) {
              tail=target.substring(target.indexOf(SHARP));
              target=target.substring(0,target.indexOf(SHARP));
            }
            if (new File(target).isAbsolute()) {
              target=FileUtils.getRelativePathFromMap(rootFilePath,target);
            }
            target=FileUtils.normalizeDirectory(currentDir,target);
            keysDefMap.put(key,new KeyDef(key,target + tail,null));
          }
        }
 else         if (!StringUtils.isEmptyString(keyRef)) {
          keysRefMap.put(key,keyRef);
        }
 else {
          keysDefMap.put(key,new KeyDef(null,null,null));
        }
      }
 else {
        final Properties prop=new Properties();
        prop.setProperty("String_Node_Str",key);
        prop.setProperty("String_Node_Str",target);
        logger.logInfo(MessageUtils.getMessage("String_Node_Str",prop).toString());
      }
      target=temp;
    }
  }
  if ("String_Node_Str".equalsIgnoreCase(attrScope) || "String_Node_Str".equalsIgnoreCase(attrScope) || attrValue.indexOf(COLON_DOUBLE_SLASH) != -1 || attrValue.startsWith(SHARP)) {
    return;
  }
  if (attrValue.startsWith("String_Node_Str") && attrValue.indexOf("String_Node_Str") == -1) {
    attrValue=attrValue.substring("String_Node_Str".length());
    if (UNIX_SEPARATOR.equals(File.separator)) {
      attrValue=UNIX_SEPARATOR + attrValue;
    }
  }
  final File target=new File(attrValue);
  if (target.isAbsolute() && !ATTRIBUTE_NAME_DATA.equals(attrName)) {
    attrValue=FileUtils.getRelativePathFromMap(rootFilePath,attrValue);
  }
 else   if (ATTRIBUTE_NAME_DATA.equals(attrName)) {
    if (!StringUtils.isEmptyString(codebase)) {
      filename=FileUtils.normalizeDirectory(codebase,attrValue);
    }
 else {
      filename=FileUtils.normalizeDirectory(currentDir,attrValue);
    }
  }
 else {
    filename=FileUtils.normalizeDirectory(currentDir,attrValue);
  }
  if (filename != null) {
    try {
      filename=URLDecoder.decode(filename,UTF8);
    }
 catch (    final UnsupportedEncodingException e) {
    }
  }
  if (MAP_TOPICREF.matches(attrClass)) {
    if (ATTR_TYPE_VALUE_SUBJECT_SCHEME.equalsIgnoreCase(attrType)) {
      schemeSet.add(filename);
    }
    if (INDEX_TYPE_ECLIPSEHELP.equals(transtype)) {
      if (attrFormat == null || ATTR_FORMAT_VALUE_DITA.equalsIgnoreCase(attrFormat)) {
        if (attrName.equals(ATTRIBUTE_NAME_HREF)) {
          topicHref=filename;
          topicHref=topicHref.replace(WINDOWS_SEPARATOR,UNIX_SEPARATOR);
          if (attrValue.lastIndexOf(SHARP) != -1) {
            final int position=attrValue.lastIndexOf(SHARP);
            topicId=attrValue.substring(position + 1);
          }
 else {
            if (FileUtils.isDITAFile(topicHref)) {
              topicId=topicHref + QUESTION;
            }
          }
        }
      }
 else {
        topicHref="String_Node_Str";
        topicId="String_Node_Str";
      }
    }
  }
  if (("String_Node_Str".equals(attrType) && ATTRIBUTE_NAME_DATA.equals(attrName)) || attrClass != null && PR_D_CODEREF.matches(attrClass)) {
    subsidiarySet.add(filename);
    return;
  }
  if (filename != null && FileUtils.isValidTarget(filename.toLowerCase()) && (StringUtils.isEmptyString(atts.getValue(ATTRIBUTE_NAME_COPY_TO)) || !FileUtils.isTopicFile(atts.getValue(ATTRIBUTE_NAME_COPY_TO).toLowerCase()) || (atts.getValue(ATTRIBUTE_NAME_CHUNK) != null && atts.getValue(ATTRIBUTE_NAME_CHUNK).contains("String_Node_Str"))) && !ATTRIBUTE_NAME_CONREF.equals(attrName) && !ATTRIBUTE_NAME_COPY_TO.equals(attrName) && (canResolved() || FileUtils.isSupportedImageFile(filename.toLowerCase()))) {
    if (attrFormat != null) {
      nonConrefCopytoTargets.add(filename + STICK + attrFormat);
    }
 else {
      nonConrefCopytoTargets.add(filename);
    }
  }
  if (attrFormat != null && !ATTR_FORMAT_VALUE_DITA.equalsIgnoreCase(attrFormat)) {
    return;
  }
  if (ATTRIBUTE_NAME_HREF.equals(attrName) && FileUtils.isTopicFile(filename) && canResolved()) {
    hrefTargets.add(new File(filename).getPath());
    toOutFile(new File(filename).getPath());
    if (chunkLevel > 0 && chunkToNavLevel == 0 && topicGroupLevel == 0 && relTableLevel == 0) {
      chunkTopicSet.add(filename);
    }
 else {
      hrefTopicSet.add(filename);
    }
  }
  if (ATTRIBUTE_NAME_CONREF.equals(attrName) && FileUtils.isDITAFile(filename)) {
    conrefTargets.add(filename);
    toOutFile(new File(filename).getPath());
  }
  if (ATTRIBUTE_NAME_COPY_TO.equals(attrName) && FileUtils.isTopicFile(filename)) {
    final String href=atts.getValue(ATTRIBUTE_NAME_HREF);
    if (StringUtils.isEmptyString(href)) {
      final StringBuffer buff=new StringBuffer();
      buff.append("String_Node_Str");
      buff.append(filename);
      buff.append("String_Node_Str");
      logger.logWarn(buff.toString());
    }
 else     if (copytoMap.get(filename) != null) {
      final Properties prop=new Properties();
      prop.setProperty("String_Node_Str",href);
      prop.setProperty("String_Node_Str",filename);
      logger.logWarn(MessageUtils.getMessage("String_Node_Str",prop).toString());
      ignoredCopytoSourceSet.add(href);
    }
 else     if (!(atts.getValue(ATTRIBUTE_NAME_CHUNK) != null && atts.getValue(ATTRIBUTE_NAME_CHUNK).contains("String_Node_Str"))) {
      copytoMap.put(filename,FileUtils.normalizeDirectory(currentDir,href));
    }
    final String pathWithoutID=FileUtils.resolveFile(currentDir,attrValue);
    if (chunkLevel > 0 && chunkToNavLevel == 0 && topicGroupLevel == 0) {
      chunkTopicSet.add(pathWithoutID);
    }
 else {
      hrefTopicSet.add(pathWithoutID);
    }
  }
  if (ATTRIBUTE_NAME_CONACTION.equals(attrName)) {
    if (attrValue.equals("String_Node_Str") || attrValue.equals("String_Node_Str")) {
      hasconaction=true;
    }
  }
}

Fixed version (ground truth):
/** 
 * Parse the input attributes for needed information.
 */
private void parseAttribute(final Attributes atts,final String attrName) throws SAXException {
  String attrValue=atts.getValue(attrName);
  String filename=null;
  final String attrClass=atts.getValue(ATTRIBUTE_NAME_CLASS);
  final String attrScope=atts.getValue(ATTRIBUTE_NAME_SCOPE);
  final String attrFormat=atts.getValue(ATTRIBUTE_NAME_FORMAT);
  final String attrType=atts.getValue(ATTRIBUTE_NAME_TYPE);
  final String codebase=atts.getValue(ATTRIBUTE_NAME_CODEBASE);
  if (attrValue == null) {
    return;
  }
  if (ATTRIBUTE_NAME_CONREF.equals(attrName) || ATTRIBUTE_NAME_CONKEYREF.equals(attrName)) {
    hasConRef=true;
  }
 else   if (ATTRIBUTE_NAME_HREF.equals(attrName)) {
    if (attrClass != null && PR_D_CODEREF.matches(attrClass)) {
      hasCodeRef=true;
    }
 else {
      hasHref=true;
    }
  }
 else   if (ATTRIBUTE_NAME_KEYREF.equals(attrName)) {
    hasKeyRef=true;
  }
  if (ATTRIBUTE_NAME_KEYS.equals(attrName) && attrValue.length() != 0) {
    String target=atts.getValue(ATTRIBUTE_NAME_HREF);
    final String keyRef=atts.getValue(ATTRIBUTE_NAME_KEYREF);
    final String copy_to=atts.getValue(ATTRIBUTE_NAME_COPY_TO);
    if (!StringUtils.isEmptyString(copy_to)) {
      target=copy_to;
    }
    if (target == null) {
      target="String_Node_Str";
    }
    final String temp=target;
    for (    final String key : attrValue.split("String_Node_Str")) {
      if (!keysDefMap.containsKey(key) && !key.equals("String_Node_Str")) {
        if (target != null && target.length() != 0) {
          if (attrScope != null && (attrScope.equals("String_Node_Str") || attrScope.equals("String_Node_Str"))) {
            exKeysDefMap.put(key,target);
            keysDefMap.put(key,new KeyDef(key,target,null));
          }
 else {
            String tail="String_Node_Str";
            if (target.indexOf(SHARP) != -1) {
              tail=target.substring(target.indexOf(SHARP));
              target=target.substring(0,target.indexOf(SHARP));
            }
            if (new File(target).isAbsolute()) {
              target=FileUtils.getRelativePathFromMap(rootFilePath,target);
            }
            target=FileUtils.normalizeDirectory(currentDir,target);
            keysDefMap.put(key,new KeyDef(key,target + tail,null));
          }
        }
 else         if (!StringUtils.isEmptyString(keyRef)) {
          keysRefMap.put(key,keyRef);
        }
 else {
          keysDefMap.put(key,new KeyDef(key,null,null));
        }
      }
 else {
        final Properties prop=new Properties();
        prop.setProperty("String_Node_Str",key);
        prop.setProperty("String_Node_Str",target);
        logger.logInfo(MessageUtils.getMessage("String_Node_Str",prop).toString());
      }
      target=temp;
    }
  }
  if ("String_Node_Str".equalsIgnoreCase(attrScope) || "String_Node_Str".equalsIgnoreCase(attrScope) || attrValue.indexOf(COLON_DOUBLE_SLASH) != -1 || attrValue.startsWith(SHARP)) {
    return;
  }
  if (attrValue.startsWith("String_Node_Str") && attrValue.indexOf("String_Node_Str") == -1) {
    attrValue=attrValue.substring("String_Node_Str".length());
    if (UNIX_SEPARATOR.equals(File.separator)) {
      attrValue=UNIX_SEPARATOR + attrValue;
    }
  }
  final File target=new File(attrValue);
  if (target.isAbsolute() && !ATTRIBUTE_NAME_DATA.equals(attrName)) {
    attrValue=FileUtils.getRelativePathFromMap(rootFilePath,attrValue);
  }
 else   if (ATTRIBUTE_NAME_DATA.equals(attrName)) {
    if (!StringUtils.isEmptyString(codebase)) {
      filename=FileUtils.normalizeDirectory(codebase,attrValue);
    }
 else {
      filename=FileUtils.normalizeDirectory(currentDir,attrValue);
    }
  }
 else {
    filename=FileUtils.normalizeDirectory(currentDir,attrValue);
  }
  if (filename != null) {
    try {
      filename=URLDecoder.decode(filename,UTF8);
    }
 catch (    final UnsupportedEncodingException e) {
    }
  }
  if (MAP_TOPICREF.matches(attrClass)) {
    if (ATTR_TYPE_VALUE_SUBJECT_SCHEME.equalsIgnoreCase(attrType)) {
      schemeSet.add(filename);
    }
    if (INDEX_TYPE_ECLIPSEHELP.equals(transtype)) {
      if (attrFormat == null || ATTR_FORMAT_VALUE_DITA.equalsIgnoreCase(attrFormat)) {
        if (attrName.equals(ATTRIBUTE_NAME_HREF)) {
          topicHref=filename;
          topicHref=topicHref.replace(WINDOWS_SEPARATOR,UNIX_SEPARATOR);
          if (attrValue.lastIndexOf(SHARP) != -1) {
            final int position=attrValue.lastIndexOf(SHARP);
            topicId=attrValue.substring(position + 1);
          }
 else {
            if (FileUtils.isDITAFile(topicHref)) {
              topicId=topicHref + QUESTION;
            }
          }
        }
      }
 else {
        topicHref="String_Node_Str";
        topicId="String_Node_Str";
      }
    }
  }
  if (("String_Node_Str".equals(attrType) && ATTRIBUTE_NAME_DATA.equals(attrName)) || attrClass != null && PR_D_CODEREF.matches(attrClass)) {
    subsidiarySet.add(filename);
    return;
  }
  if (filename != null && FileUtils.isValidTarget(filename.toLowerCase()) && (StringUtils.isEmptyString(atts.getValue(ATTRIBUTE_NAME_COPY_TO)) || !FileUtils.isTopicFile(atts.getValue(ATTRIBUTE_NAME_COPY_TO).toLowerCase()) || (atts.getValue(ATTRIBUTE_NAME_CHUNK) != null && atts.getValue(ATTRIBUTE_NAME_CHUNK).contains("String_Node_Str"))) && !ATTRIBUTE_NAME_CONREF.equals(attrName) && !ATTRIBUTE_NAME_COPY_TO.equals(attrName) && (canResolved() || FileUtils.isSupportedImageFile(filename.toLowerCase()))) {
    if (attrFormat != null) {
      nonConrefCopytoTargets.add(filename + STICK + attrFormat);
    }
 else {
      nonConrefCopytoTargets.add(filename);
    }
  }
  if (attrFormat != null && !ATTR_FORMAT_VALUE_DITA.equalsIgnoreCase(attrFormat)) {
    return;
  }
  if (ATTRIBUTE_NAME_HREF.equals(attrName) && FileUtils.isTopicFile(filename) && canResolved()) {
    hrefTargets.add(new File(filename).getPath());
    toOutFile(new File(filename).getPath());
    if (chunkLevel > 0 && chunkToNavLevel == 0 && topicGroupLevel == 0 && relTableLevel == 0) {
      chunkTopicSet.add(filename);
    }
 else {
      hrefTopicSet.add(filename);
    }
  }
  if (ATTRIBUTE_NAME_CONREF.equals(attrName) && FileUtils.isDITAFile(filename)) {
    conrefTargets.add(filename);
    toOutFile(new File(filename).getPath());
  }
  if (ATTRIBUTE_NAME_COPY_TO.equals(attrName) && FileUtils.isTopicFile(filename)) {
    final String href=atts.getValue(ATTRIBUTE_NAME_HREF);
    if (StringUtils.isEmptyString(href)) {
      final StringBuffer buff=new StringBuffer();
      buff.append("String_Node_Str");
      buff.append(filename);
      buff.append("String_Node_Str");
      logger.logWarn(buff.toString());
    }
 else     if (copytoMap.get(filename) != null) {
      final Properties prop=new Properties();
      prop.setProperty("String_Node_Str",href);
      prop.setProperty("String_Node_Str",filename);
      logger.logWarn(MessageUtils.getMessage("String_Node_Str",prop).toString());
      ignoredCopytoSourceSet.add(href);
    }
 else     if (!(atts.getValue(ATTRIBUTE_NAME_CHUNK) != null && atts.getValue(ATTRIBUTE_NAME_CHUNK).contains("String_Node_Str"))) {
      copytoMap.put(filename,FileUtils.normalizeDirectory(currentDir,href));
    }
    final String pathWithoutID=FileUtils.resolveFile(currentDir,attrValue);
    if (chunkLevel > 0 && chunkToNavLevel == 0 && topicGroupLevel == 0) {
      chunkTopicSet.add(pathWithoutID);
    }
 else {
      hrefTopicSet.add(pathWithoutID);
    }
  }
  if (ATTRIBUTE_NAME_CONACTION.equals(attrName)) {
    if (attrValue.equals("String_Node_Str") || attrValue.equals("String_Node_Str")) {
      hasconaction=true;
    }
  }
}