Program: 137788
Project: 137788
Buggy source:
private static Map<PatternToExcelEnum,String> getRelatedValueFromPattern(Pattern pattern,IFolder folder){
  Map<PatternToExcelEnum,String> patternMap=new HashMap<PatternToExcelEnum,String>();
  if (folder != null) {
    IFile file=ResourceFileMap.findCorrespondingFile(pattern);
    URI parentURI=ResourceManager.getPatternFolder().getLocationURI();
    String relativePath=parentURI.relativize(file.getParent().getLocationURI()).toString();
    relativePath=relativePath.substring(relativePath.indexOf('/') + 1);
    patternMap.put(PatternToExcelEnum.Label,pattern.getName());
    patternMap.put(PatternToExcelEnum.Purpose,MetadataHelper.getPurpose(pattern));
    patternMap.put(PatternToExcelEnum.Description,MetadataHelper.getDescription(pattern));
    patternMap.put(PatternToExcelEnum.Author,MetadataHelper.getAuthor(pattern));
    patternMap.put(PatternToExcelEnum.RelativePath,relativePath);
    for (    PatternLanguageType languagetype : PatternLanguageType.values()) {
      for (      PatternComponent component : pattern.getComponents()) {
        Expression expression=((RegularExpression)component).getExpression();
        if (expression != null && expression.getLanguage().equalsIgnoreCase(languagetype.getLiteral())) {
          patternMap.put(languagetype.getExcelEnum(),expression.getBody());
        }
      }
      if (!patternMap.containsKey(languagetype.getExcelEnum())) {
        patternMap.put(languagetype.getExcelEnum(),"String_Node_Str");
      }
    }
  }
  return patternMap;
}

Fixed version (ground truth):
private static Map<PatternToExcelEnum,String> getRelatedValueFromPattern(Pattern pattern,IFolder folder){
  Map<PatternToExcelEnum,String> patternMap=new HashMap<PatternToExcelEnum,String>();
  if (folder != null) {
    IFile file=ResourceFileMap.findCorrespondingFile(pattern);
    URI parentURI=ResourceManager.getPatternFolder().getLocationURI();
    String relativePath=parentURI.relativize(file.getParent().getLocationURI()).toString();
    relativePath=relativePath.substring(relativePath.indexOf('/') + 1);
    if (EResourceConstant.PATTERN_REGEX.getName().equals(relativePath) || EResourceConstant.PATTERN_SQL.getName().equals(relativePath)) {
      relativePath=PluginConstant.EMPTY_STRING;
    }
    patternMap.put(PatternToExcelEnum.Label,pattern.getName());
    patternMap.put(PatternToExcelEnum.Purpose,MetadataHelper.getPurpose(pattern));
    patternMap.put(PatternToExcelEnum.Description,MetadataHelper.getDescription(pattern));
    patternMap.put(PatternToExcelEnum.Author,MetadataHelper.getAuthor(pattern));
    patternMap.put(PatternToExcelEnum.RelativePath,relativePath);
    for (    PatternLanguageType languagetype : PatternLanguageType.values()) {
      for (      PatternComponent component : pattern.getComponents()) {
        Expression expression=((RegularExpression)component).getExpression();
        if (expression != null && expression.getLanguage().equalsIgnoreCase(languagetype.getLiteral())) {
          patternMap.put(languagetype.getExcelEnum(),expression.getBody());
        }
      }
      if (!patternMap.containsKey(languagetype.getExcelEnum())) {
        patternMap.put(languagetype.getExcelEnum(),"String_Node_Str");
      }
    }
  }
  return patternMap;
}