Program: 91706
Project: 91706
Buggy source:
public static void calculateEffectiveLifecycleMappingMetadata(LifecycleMappingResult result,MavenExecutionRequest templateRequest,List<MappingMetadataSource> metadataSources,MavenProject mavenProject,List<MojoExecution> mojoExecutions){
  IMaven maven=MavenPlugin.getDefault().getMaven();
  MavenSession session=maven.createSession(newMavenExecutionRequest(templateRequest),mavenProject);
  LifecycleMappingMetadata lifecycleMappingMetadata=null;
  MappingMetadataSource originalMetadataSource=null;
  for (int i=0; i < metadataSources.size(); i++) {
    MappingMetadataSource source=metadataSources.get(i);
    try {
      lifecycleMappingMetadata=source.getLifecycleMappingMetadata(mavenProject.getPackaging());
      if (lifecycleMappingMetadata != null) {
        originalMetadataSource=new SimpleMappingMetadataSource(lifecycleMappingMetadata);
        metadataSources.add(i,originalMetadataSource);
        break;
      }
    }
 catch (    DuplicateMappingException e) {
      log.error("String_Node_Str",mavenProject.toString());
      result.addProblem(new MavenProblemInfo(1,NLS.bind(Messages.LifecycleDuplicate,mavenProject.getPackaging())));
      return;
    }
  }
  if (lifecycleMappingMetadata == null) {
    lifecycleMappingMetadata=new LifecycleMappingMetadata();
    lifecycleMappingMetadata.setLifecycleMappingId("String_Node_Str");
    lifecycleMappingMetadata.setPackagingType(mavenProject.getPackaging());
  }
  result.setLifecycleMappingMetadata(lifecycleMappingMetadata);
  Map<MojoExecutionKey,List<PluginExecutionMetadata>> executionMapping=new LinkedHashMap<MojoExecutionKey,List<PluginExecutionMetadata>>();
  if (mojoExecutions != null) {
    for (    MojoExecution execution : mojoExecutions) {
      MojoExecutionKey executionKey=new MojoExecutionKey(execution);
      PluginExecutionMetadata primaryMetadata=null;
      try {
        for (        MappingMetadataSource source : metadataSources) {
          List<PluginExecutionMetadata> metadatas=applyParametersFilter(session,source.getPluginExecutionMetadata(executionKey),mavenProject,execution);
          for (          PluginExecutionMetadata executionMetadata : metadatas) {
            if (LifecycleMappingFactory.isPrimaryMapping(executionMetadata)) {
              if (primaryMetadata != null) {
                primaryMetadata=null;
                throw new DuplicateMappingException();
              }
              primaryMetadata=executionMetadata;
            }
          }
          if (primaryMetadata != null) {
            break;
          }
        }
      }
 catch (      DuplicateMappingException e) {
        log.debug("String_Node_Str",executionKey.toString());
        result.addProblem(new MavenProblemInfo(1,NLS.bind(Messages.PluginExecutionMappingDuplicate,executionKey.toString())));
      }
      if (primaryMetadata != null && !isValidPluginExecutionMetadata(primaryMetadata)) {
        log.debug("String_Node_Str",executionKey.toString());
        result.addProblem(new MavenProblemInfo(1,NLS.bind(Messages.PluginExecutionMappingInvalid,executionKey.toString())));
        primaryMetadata=null;
      }
      List<PluginExecutionMetadata> executionMetadatas=new ArrayList<PluginExecutionMetadata>();
      if (primaryMetadata != null) {
        executionMetadatas.add(primaryMetadata);
        if (primaryMetadata.getAction() == PluginExecutionAction.configurator) {
          for (          MappingMetadataSource source : metadataSources) {
            List<PluginExecutionMetadata> metadatas=source.getPluginExecutionMetadata(executionKey);
            metadatas=applyParametersFilter(session,metadatas,mavenProject,execution);
            for (            PluginExecutionMetadata metadata : metadatas) {
              if (isValidPluginExecutionMetadata(metadata)) {
                if (metadata.getAction() == PluginExecutionAction.configurator && isSecondaryMapping(metadata,primaryMetadata)) {
                  executionMetadatas.add(metadata);
                }
              }
 else {
                log.debug("String_Node_Str",executionKey.toString());
              }
            }
          }
        }
      }
      executionMapping.put(executionKey,executionMetadatas);
    }
  }
 else {
    log.debug("String_Node_Str",mavenProject.toString());
  }
  result.setMojoExecutionMapping(executionMapping);
}

Fixed version (ground truth):
public static void calculateEffectiveLifecycleMappingMetadata(LifecycleMappingResult result,MavenExecutionRequest templateRequest,List<MappingMetadataSource> metadataSources,MavenProject mavenProject,List<MojoExecution> mojoExecutions){
  IMaven maven=MavenPlugin.getDefault().getMaven();
  MavenSession session=maven.createSession(newMavenExecutionRequest(templateRequest),mavenProject);
  LifecycleMappingMetadata lifecycleMappingMetadata=null;
  MappingMetadataSource originalMetadataSource=null;
  for (int i=0; i < metadataSources.size(); i++) {
    MappingMetadataSource source=metadataSources.get(i);
    try {
      lifecycleMappingMetadata=source.getLifecycleMappingMetadata(mavenProject.getPackaging());
      if (lifecycleMappingMetadata != null) {
        originalMetadataSource=new SimpleMappingMetadataSource(lifecycleMappingMetadata);
        metadataSources.add(i,originalMetadataSource);
        break;
      }
    }
 catch (    DuplicateMappingException e) {
      log.error("String_Node_Str",mavenProject.toString());
      result.addProblem(new MavenProblemInfo(1,NLS.bind(Messages.LifecycleDuplicate,mavenProject.getPackaging())));
      return;
    }
  }
  if (lifecycleMappingMetadata == null) {
    lifecycleMappingMetadata=new LifecycleMappingMetadata();
    lifecycleMappingMetadata.setLifecycleMappingId("String_Node_Str");
    lifecycleMappingMetadata.setPackagingType(mavenProject.getPackaging());
  }
  result.setLifecycleMappingMetadata(lifecycleMappingMetadata);
  Map<MojoExecutionKey,List<PluginExecutionMetadata>> executionMapping=new LinkedHashMap<MojoExecutionKey,List<PluginExecutionMetadata>>();
  if (mojoExecutions != null) {
    for (    MojoExecution execution : mojoExecutions) {
      MojoExecutionKey executionKey=new MojoExecutionKey(execution);
      PluginExecutionMetadata primaryMetadata=null;
      try {
        for (        MappingMetadataSource source : metadataSources) {
          try {
            List<PluginExecutionMetadata> metadatas=applyParametersFilter(session,source.getPluginExecutionMetadata(executionKey),mavenProject,execution);
            for (            PluginExecutionMetadata executionMetadata : metadatas) {
              if (LifecycleMappingFactory.isPrimaryMapping(executionMetadata)) {
                if (primaryMetadata != null) {
                  primaryMetadata=null;
                  throw new DuplicateMappingException();
                }
                primaryMetadata=executionMetadata;
              }
            }
            if (primaryMetadata != null) {
              break;
            }
          }
 catch (          CoreException e) {
            SourceLocation location=SourceLocationHelper.findLocation(mavenProject,executionKey);
            result.addProblem(new MavenProblemInfo(location,e));
          }
        }
      }
 catch (      DuplicateMappingException e) {
        log.debug("String_Node_Str",executionKey.toString());
        result.addProblem(new MavenProblemInfo(1,NLS.bind(Messages.PluginExecutionMappingDuplicate,executionKey.toString())));
      }
      if (primaryMetadata != null && !isValidPluginExecutionMetadata(primaryMetadata)) {
        log.debug("String_Node_Str",executionKey.toString());
        result.addProblem(new MavenProblemInfo(1,NLS.bind(Messages.PluginExecutionMappingInvalid,executionKey.toString())));
        primaryMetadata=null;
      }
      List<PluginExecutionMetadata> executionMetadatas=new ArrayList<PluginExecutionMetadata>();
      if (primaryMetadata != null) {
        executionMetadatas.add(primaryMetadata);
        if (primaryMetadata.getAction() == PluginExecutionAction.configurator) {
          for (          MappingMetadataSource source : metadataSources) {
            try {
              List<PluginExecutionMetadata> metadatas=source.getPluginExecutionMetadata(executionKey);
              metadatas=applyParametersFilter(session,metadatas,mavenProject,execution);
              for (              PluginExecutionMetadata metadata : metadatas) {
                if (isValidPluginExecutionMetadata(metadata)) {
                  if (metadata.getAction() == PluginExecutionAction.configurator && isSecondaryMapping(metadata,primaryMetadata)) {
                    executionMetadatas.add(metadata);
                  }
                }
 else {
                  log.debug("String_Node_Str",executionKey.toString());
                }
              }
            }
 catch (            CoreException e) {
              SourceLocation location=SourceLocationHelper.findLocation(mavenProject,executionKey);
              result.addProblem(new MavenProblemInfo(location,e));
            }
          }
        }
      }
      executionMapping.put(executionKey,executionMetadatas);
    }
  }
 else {
    log.debug("String_Node_Str",mavenProject.toString());
  }
  result.setMojoExecutionMapping(executionMapping);
}