Program: 125838
Project: 125838
Buggy source:
public String getMavenUriSnapshot(){
  MavenArtifact artifact=null;
  if (getMavenUri() != null) {
    if (getMavenUri().split(MavenUrlHelper.SEPERATOR).length < 4 && getModuleName().lastIndexOf("String_Node_Str") != -1) {
      String extension=getModuleName().substring(getModuleName().lastIndexOf("String_Node_Str") + 1,getModuleName().length());
      artifact=MavenUrlHelper.parseMvnUrl(getMavenUri());
      artifact.setType(extension);
    }
 else {
      artifact=MavenUrlHelper.parseMvnUrl(getMavenUri());
    }
  }
  if (artifact != null && !MavenConstants.DEFAULT_LIB_GROUP_ID.equals(artifact.getGroupId())) {
    return getMavenUri();
  }
  if (StringUtils.isEmpty(mavenUriSnapshot) && artifact != null) {
    mavenUriSnapshot=MavenUrlHelper.generateMvnUrl(artifact.getGroupId(),artifact.getArtifactId(),artifact.getVersion() + "String_Node_Str",artifact.getType(),artifact.getClassifier());
  }
  if (StringUtils.isEmpty(mavenUriSnapshot)) {
    ILibraryManagerService libManagerService=(ILibraryManagerService)GlobalServiceRegister.getDefault().getService(ILibraryManagerService.class);
    String mvnUrisFromIndex=libManagerService.getMavenUriFromIndex(getModuleName());
    if (mvnUrisFromIndex != null) {
      final String[] split=mvnUrisFromIndex.split(MavenUrlHelper.MVN_INDEX_SPLITER);
      String maxVerstion=null;
      for (      String mvnUri : split) {
        if (maxVerstion == null) {
          maxVerstion=mvnUri;
        }
 else {
          MavenArtifact lastArtifact=MavenUrlHelper.parseMvnUrl(maxVerstion);
          MavenArtifact currentArtifact=MavenUrlHelper.parseMvnUrl(mvnUri);
          if (lastArtifact != null && currentArtifact != null) {
            String lastV=lastArtifact.getVersion();
            lastV=lastV.replace(MavenConstants.SNAPSHOT,"String_Node_Str");
            String currentV=currentArtifact.getVersion();
            currentV=currentV.replace(MavenConstants.SNAPSHOT,"String_Node_Str");
            if (!lastV.equals(currentV)) {
              Version lastVersion=new Version(lastV);
              Version currentVersion=new Version(currentV);
              if (currentVersion.compareTo(lastVersion) > 0) {
                maxVerstion=mvnUri;
              }
            }
          }
        }
      }
      mavenUriSnapshot=maxVerstion;
    }
  }
  if (StringUtils.isEmpty(mavenUriSnapshot)) {
    mavenUriSnapshot=MavenUrlHelper.generateMvnUrlForJarName(getModuleName());
  }
  return mavenUriSnapshot;
}

Fixed version (ground truth):
public String getMavenUriSnapshot(){
  MavenArtifact artifact=null;
  if (getMavenUri() != null) {
    if (getMavenUri().split(MavenUrlHelper.SEPERATOR).length < 4 && getModuleName().lastIndexOf("String_Node_Str") != -1) {
      String extension=getModuleName().substring(getModuleName().lastIndexOf("String_Node_Str") + 1,getModuleName().length());
      artifact=MavenUrlHelper.parseMvnUrl(getMavenUri());
      if (artifact != null) {
        artifact.setType(extension);
      }
    }
 else {
      artifact=MavenUrlHelper.parseMvnUrl(getMavenUri());
    }
  }
  if (artifact != null && !MavenConstants.DEFAULT_LIB_GROUP_ID.equals(artifact.getGroupId())) {
    return getMavenUri();
  }
  if (StringUtils.isEmpty(mavenUriSnapshot) && artifact != null) {
    mavenUriSnapshot=MavenUrlHelper.generateMvnUrl(artifact.getGroupId(),artifact.getArtifactId(),artifact.getVersion() + "String_Node_Str",artifact.getType(),artifact.getClassifier());
  }
  if (StringUtils.isEmpty(mavenUriSnapshot)) {
    ILibraryManagerService libManagerService=(ILibraryManagerService)GlobalServiceRegister.getDefault().getService(ILibraryManagerService.class);
    String mvnUrisFromIndex=libManagerService.getMavenUriFromIndex(getModuleName());
    if (mvnUrisFromIndex != null) {
      final String[] split=mvnUrisFromIndex.split(MavenUrlHelper.MVN_INDEX_SPLITER);
      String maxVerstion=null;
      for (      String mvnUri : split) {
        if (maxVerstion == null) {
          maxVerstion=mvnUri;
        }
 else {
          MavenArtifact lastArtifact=MavenUrlHelper.parseMvnUrl(maxVerstion);
          MavenArtifact currentArtifact=MavenUrlHelper.parseMvnUrl(mvnUri);
          if (lastArtifact != null && currentArtifact != null) {
            String lastV=lastArtifact.getVersion();
            lastV=lastV.replace(MavenConstants.SNAPSHOT,"String_Node_Str");
            String currentV=currentArtifact.getVersion();
            currentV=currentV.replace(MavenConstants.SNAPSHOT,"String_Node_Str");
            if (!lastV.equals(currentV)) {
              Version lastVersion=new Version(lastV);
              Version currentVersion=new Version(currentV);
              if (currentVersion.compareTo(lastVersion) > 0) {
                maxVerstion=mvnUri;
              }
            }
          }
        }
      }
      mavenUriSnapshot=maxVerstion;
    }
  }
  if (StringUtils.isEmpty(mavenUriSnapshot)) {
    mavenUriSnapshot=MavenUrlHelper.generateMvnUrlForJarName(getModuleName());
  }
  return mavenUriSnapshot;
}