Program: 86533
Project: 86533
Buggy source:
/** 
 * Calculate the version modification for a given GAV.
 * @param groupId the groupId to search for
 * @param artifactId the artifactId to search for.
 * @param version the original version to search for.
 * @param session the container session.
 * @return a Version object allowing the modified version to be extracted.
 * @throws ManipulationException if an error occurs.
 */
protected Version calculate(final String groupId,final String artifactId,final String version,final ManipulationSession session) throws ManipulationException {
  final VersioningState state=session.getState(VersioningState.class);
  final String incrementalSuffix=state.getIncrementalSerialSuffix();
  final String staticSuffix=state.getSuffix();
  final String override=state.getOverride();
  logger.debug("String_Node_Str" + version);
  logger.debug("String_Node_Str" + staticSuffix + "String_Node_Str"+ incrementalSuffix);
  logger.debug("String_Node_Str" + override);
  Version versionObj;
  if (override != null) {
    versionObj=new Version(override);
  }
 else {
    versionObj=new Version(version);
  }
  if (staticSuffix != null) {
    versionObj.appendQualifierSuffix(staticSuffix);
    if (!state.preserveSnapshot()) {
      versionObj.setSnapshot(false);
    }
  }
 else   if (incrementalSuffix != null) {
    final Set<String> versionCandidates=new HashSet<String>();
    Map<ProjectRef,Set<String>> rm=state.getRESTMetadata();
    if (rm != null) {
      logger.debug("String_Node_Str" + rm);
      if (rm.size() > 0) {
        logger.debug("String_Node_Str" + rm.get(new ProjectRef(groupId,artifactId)));
        versionCandidates.addAll(rm.get(new ProjectRef(groupId,artifactId)));
      }
    }
 else {
      versionCandidates.addAll(getMetadataVersions(groupId,artifactId));
    }
    logger.debug("String_Node_Str" + versionCandidates);
    versionObj.appendQualifierSuffix(incrementalSuffix);
    int highestRemoteBuildNum=versionObj.findHighestMatchingBuildNumber(versionObj,versionCandidates);
    ++highestRemoteBuildNum;
    if (highestRemoteBuildNum > versionObj.getIntegerBuildNumber()) {
      versionObj.setBuildNumber(Integer.toString(highestRemoteBuildNum));
    }
    if (!state.preserveSnapshot()) {
      versionObj.setSnapshot(false);
    }
  }
  return versionObj;
}

Fixed version (ground truth):
/** 
 * Calculate the version modification for a given GAV.
 * @param groupId the groupId to search for
 * @param artifactId the artifactId to search for.
 * @param version the original version to search for.
 * @param session the container session.
 * @return a Version object allowing the modified version to be extracted.
 * @throws ManipulationException if an error occurs.
 */
protected Version calculate(final String groupId,final String artifactId,final String version,final ManipulationSession session) throws ManipulationException {
  final VersioningState state=session.getState(VersioningState.class);
  final String incrementalSuffix=state.getIncrementalSerialSuffix();
  final String staticSuffix=state.getSuffix();
  final String override=state.getOverride();
  logger.debug("String_Node_Str" + version);
  logger.debug("String_Node_Str" + staticSuffix + "String_Node_Str"+ incrementalSuffix);
  logger.debug("String_Node_Str" + override);
  Version versionObj;
  if (override != null) {
    versionObj=new Version(override);
  }
 else {
    versionObj=new Version(version);
  }
  if (staticSuffix != null) {
    versionObj.appendQualifierSuffix(staticSuffix);
    if (!state.preserveSnapshot()) {
      versionObj.setSnapshot(false);
    }
  }
 else   if (incrementalSuffix != null) {
    final Set<String> versionCandidates=new HashSet<String>();
    Map<ProjectRef,Set<String>> rm=state.getRESTMetadata();
    if (rm != null) {
      if (rm.size() > 0) {
        versionCandidates.addAll(rm.get(new ProjectRef(groupId,artifactId)));
      }
    }
 else {
      versionCandidates.addAll(getMetadataVersions(groupId,artifactId));
    }
    versionObj.appendQualifierSuffix(incrementalSuffix);
    int highestRemoteBuildNum=versionObj.findHighestMatchingBuildNumber(versionObj,versionCandidates);
    ++highestRemoteBuildNum;
    if (highestRemoteBuildNum > versionObj.getIntegerBuildNumber()) {
      versionObj.setBuildNumber(Integer.toString(highestRemoteBuildNum));
    }
    if (!state.preserveSnapshot()) {
      versionObj.setSnapshot(false);
    }
  }
  return versionObj;
}