Program: 86531
Project: 86531
Buggy source:
/** 
 * Apply any project versioning changes applicable for the given   {@link Model}, using accumulated version-change information stored in the  {@link VersioningState} instance, and produced during the {@link ProjectVersioningManipulator#scan(List,ManipulationSession)} invocation.These changes include the main POM version, but may also include the parent declaration and dependencies, if they reference other POMs in the current build. If the project is modified, then it is marked as changed in the  {@link ManipulationSession}, which triggers the associated POM to be rewritten.
 * @param project Project undergoing modification.
 * @return whether any changes have been applied.
 * @throws ManipulationException if an error occurs.
 */
protected boolean applyVersioningChanges(final Project project) throws ManipulationException {
  boolean changed=false;
  final Model model=project.getModel();
  if (versionsByGAV == null || versionsByGAV.isEmpty()) {
    return false;
  }
  if (model == null) {
    return false;
  }
  logger.info("String_Node_Str" + gav(model));
  logger.info("String_Node_Str" + versionsByGAV);
  String g=model.getGroupId();
  String v=model.getVersion();
  final Parent parent=model.getParent();
  if (g == null && parent != null) {
    g=parent.getGroupId();
  }
  if (v == null && parent != null) {
    v=parent.getVersion();
  }
  if (parent != null && parent.getVersion() != null) {
    final ProjectVersionRef parentGAV=new ProjectVersionRef(parent.getGroupId(),parent.getArtifactId(),parent.getVersion());
    logger.info("String_Node_Str" + parentGAV);
    if (versionsByGAV.containsKey(parentGAV)) {
      final String newVersion=versionsByGAV.get(parentGAV);
      logger.info("String_Node_Str" + newVersion + "String_Node_Str"+ parent);
      parent.setVersion(newVersion);
      changed=true;
    }
  }
  ProjectVersionRef gav=new ProjectVersionRef(g,model.getArtifactId(),v);
  if (model.getVersion() != null) {
    final String newVersion=versionsByGAV.get(gav);
    logger.info("String_Node_Str" + gav + "String_Node_Str"+ newVersion+ "String_Node_Str");
    if (newVersion != null && model.getVersion() != null) {
      model.setVersion(newVersion);
      logger.info("String_Node_Str" + gav(model));
      changed=true;
    }
  }
 else   if (changed == false && model.getVersion() == null && project.isInheritanceRoot()) {
    final String newVersion=versionsByGAV.get(gav);
    logger.info("String_Node_Str" + gav + "String_Node_Str"+ newVersion+ "String_Node_Str");
    if (newVersion != null) {
      model.setVersion(newVersion);
      logger.info("String_Node_Str" + gav(model));
      changed=true;
    }
  }
  final Set<ModelBase> bases=new HashSet<ModelBase>();
  bases.add(model);
  final List<Profile> profiles=model.getProfiles();
  if (profiles != null) {
    bases.addAll(profiles);
  }
  final StringSearchInterpolator interp=new StringSearchInterpolator();
  if (model.getProperties() != null) {
    interp.addValueSource(new PropertiesBasedValueSource(model.getProperties()));
  }
  final List<String> prefixes=Arrays.asList("String_Node_Str","String_Node_Str");
  interp.addValueSource(new PrefixedObjectValueSource(prefixes,model,true));
  final RecursionInterceptor ri=new PrefixAwareRecursionInterceptor(prefixes,true);
  for (  final ModelBase base : bases) {
    final DependencyManagement dm=base.getDependencyManagement();
    if (dm != null && dm.getDependencies() != null) {
      for (      final Dependency d : dm.getDependencies()) {
        gav=new ProjectVersionRef(interpolate(d.getGroupId(),ri,interp),interpolate(d.getArtifactId(),ri,interp),interpolate(d.getVersion(),ri,interp));
        final String newVersion=versionsByGAV.get(gav);
        if (newVersion != null) {
          d.setVersion(newVersion);
          logger.info("String_Node_Str" + d + "String_Node_Str"+ base);
          changed=true;
        }
      }
    }
    if (base.getDependencies() != null) {
      for (      final Dependency d : base.getDependencies()) {
        gav=new ProjectVersionRef(interpolate(d.getGroupId(),ri,interp),interpolate(d.getArtifactId(),ri,interp),interpolate(d.getVersion(),ri,interp));
        final String newVersion=versionsByGAV.get(gav);
        if (newVersion != null && d.getVersion() != null) {
          d.setVersion(newVersion);
          logger.info("String_Node_Str" + d + "String_Node_Str"+ base);
          changed=true;
        }
      }
    }
  }
  if (changed) {
    logger.info("String_Node_Str" + gav(model));
  }
  return changed;
}

Fixed version (ground truth):
/** 
 * Apply any project versioning changes applicable for the given   {@link Model}, using accumulated version-change information stored in the  {@link VersioningState} instance, and produced during the {@link ProjectVersioningManipulator#scan(List,ManipulationSession)} invocation.These changes include the main POM version, but may also include the parent declaration and dependencies, if they reference other POMs in the current build. If the project is modified, then it is marked as changed in the  {@link ManipulationSession}, which triggers the associated POM to be rewritten.
 * @param project Project undergoing modification.
 * @return whether any changes have been applied.
 * @throws ManipulationException if an error occurs.
 */
protected boolean applyVersioningChanges(final Project project) throws ManipulationException {
  boolean changed=false;
  final Model model=project.getModel();
  if (versionsByGAV == null || versionsByGAV.isEmpty()) {
    return false;
  }
  if (model == null) {
    return false;
  }
  logger.info("String_Node_Str" + gav(model));
  String g=model.getGroupId();
  String v=model.getVersion();
  final Parent parent=model.getParent();
  if (g == null && parent != null) {
    g=parent.getGroupId();
  }
  if (v == null && parent != null) {
    v=parent.getVersion();
  }
  if (parent != null && parent.getVersion() != null) {
    final ProjectVersionRef parentGAV=new ProjectVersionRef(parent.getGroupId(),parent.getArtifactId(),parent.getVersion());
    logger.info("String_Node_Str" + parentGAV);
    if (versionsByGAV.containsKey(parentGAV)) {
      final String newVersion=versionsByGAV.get(parentGAV);
      logger.info("String_Node_Str" + newVersion + "String_Node_Str"+ parent);
      parent.setVersion(newVersion);
      changed=true;
    }
  }
  ProjectVersionRef gav=new ProjectVersionRef(g,model.getArtifactId(),v);
  if (model.getVersion() != null) {
    final String newVersion=versionsByGAV.get(gav);
    logger.info("String_Node_Str" + gav + "String_Node_Str"+ newVersion+ "String_Node_Str");
    if (newVersion != null && model.getVersion() != null) {
      model.setVersion(newVersion);
      logger.info("String_Node_Str" + gav(model));
      changed=true;
    }
  }
 else   if (changed == false && model.getVersion() == null && project.isInheritanceRoot()) {
    final String newVersion=versionsByGAV.get(gav);
    logger.info("String_Node_Str" + gav + "String_Node_Str"+ newVersion+ "String_Node_Str");
    if (newVersion != null) {
      model.setVersion(newVersion);
      logger.info("String_Node_Str" + gav(model));
      changed=true;
    }
  }
  final Set<ModelBase> bases=new HashSet<ModelBase>();
  bases.add(model);
  final List<Profile> profiles=model.getProfiles();
  if (profiles != null) {
    bases.addAll(profiles);
  }
  final StringSearchInterpolator interp=new StringSearchInterpolator();
  if (model.getProperties() != null) {
    interp.addValueSource(new PropertiesBasedValueSource(model.getProperties()));
  }
  final List<String> prefixes=Arrays.asList("String_Node_Str","String_Node_Str");
  interp.addValueSource(new PrefixedObjectValueSource(prefixes,model,true));
  final RecursionInterceptor ri=new PrefixAwareRecursionInterceptor(prefixes,true);
  for (  final ModelBase base : bases) {
    final DependencyManagement dm=base.getDependencyManagement();
    if (dm != null && dm.getDependencies() != null) {
      for (      final Dependency d : dm.getDependencies()) {
        gav=new ProjectVersionRef(interpolate(d.getGroupId(),ri,interp),interpolate(d.getArtifactId(),ri,interp),interpolate(d.getVersion(),ri,interp));
        final String newVersion=versionsByGAV.get(gav);
        if (newVersion != null) {
          d.setVersion(newVersion);
          logger.info("String_Node_Str" + d + "String_Node_Str"+ base);
          changed=true;
        }
      }
    }
    if (base.getDependencies() != null) {
      for (      final Dependency d : base.getDependencies()) {
        gav=new ProjectVersionRef(interpolate(d.getGroupId(),ri,interp),interpolate(d.getArtifactId(),ri,interp),interpolate(d.getVersion(),ri,interp));
        final String newVersion=versionsByGAV.get(gav);
        if (newVersion != null && d.getVersion() != null) {
          d.setVersion(newVersion);
          logger.info("String_Node_Str" + d + "String_Node_Str"+ base);
          changed=true;
        }
      }
    }
  }
  if (changed) {
    logger.info("String_Node_Str" + gav(model));
  }
  return changed;
}