Program: 20780
Project: 20780
Buggy source:
public static Artifact buildArtifact(String path,ArtifactFactory artifactFactory){
  List pathParts=new ArrayList();
  StringTokenizer st=new StringTokenizer(path,"String_Node_Str");
  while (st.hasMoreTokens()) {
    pathParts.add(st.nextToken());
  }
  Collections.reverse(pathParts);
  Artifact artifact=null;
  if (pathParts.size() >= 4) {
    String filename=(String)pathParts.remove(0);
    String version=(String)pathParts.remove(0);
    String artifactId=(String)pathParts.remove(0);
    Collections.reverse(pathParts);
    String groupId=StringUtils.join(pathParts.iterator(),"String_Node_Str");
    String remainingFilename=filename;
    if (!remainingFilename.startsWith(artifactId + "String_Node_Str")) {
      return null;
    }
 else {
      remainingFilename=remainingFilename.substring(artifactId.length() + 1);
      String classifier=null;
      String type;
      if (remainingFilename.endsWith("String_Node_Str")) {
        type="String_Node_Str";
        remainingFilename=remainingFilename.substring(0,remainingFilename.length() - "String_Node_Str".length());
      }
 else       if (remainingFilename.endsWith("String_Node_Str")) {
        type="String_Node_Str";
        remainingFilename=remainingFilename.substring(0,remainingFilename.length() - "String_Node_Str".length());
      }
 else       if (remainingFilename.endsWith("String_Node_Str")) {
        type="String_Node_Str";
        classifier="String_Node_Str";
        remainingFilename=remainingFilename.substring(0,remainingFilename.length() - "String_Node_Str".length());
      }
 else {
        int index=remainingFilename.lastIndexOf("String_Node_Str");
        if (index < 0) {
          return null;
        }
 else {
          type=remainingFilename.substring(index + 1);
          remainingFilename=remainingFilename.substring(0,index);
        }
      }
      if (type != null) {
        Artifact result;
        if (classifier == null) {
          result=artifactFactory.createArtifact(groupId,artifactId,version,Artifact.SCOPE_RUNTIME,type);
        }
 else {
          result=artifactFactory.createArtifactWithClassifier(groupId,artifactId,version,type,classifier);
        }
        if (result.isSnapshot()) {
          int classifierIndex=remainingFilename.indexOf('-',version.length() + 8);
          if (classifierIndex >= 0) {
            classifier=remainingFilename.substring(classifierIndex + 1);
            remainingFilename=remainingFilename.substring(0,classifierIndex);
            result=artifactFactory.createArtifactWithClassifier(groupId,artifactId,remainingFilename,type,classifier);
          }
 else {
            result=artifactFactory.createArtifact(groupId,artifactId,remainingFilename,Artifact.SCOPE_RUNTIME,type);
          }
          if (!result.isSnapshot()) {
            return null;
          }
 else           if (!result.getBaseVersion().equals(version)) {
            return null;
          }
 else {
            artifact=result;
          }
        }
 else         if (!remainingFilename.startsWith(version)) {
          return null;
        }
 else         if (!remainingFilename.equals(version)) {
          if (remainingFilename.charAt(version.length()) != '-') {
            return null;
          }
 else {
            classifier=remainingFilename.substring(version.length() + 1);
            artifact=artifactFactory.createArtifactWithClassifier(groupId,artifactId,version,type,classifier);
          }
        }
 else {
          artifact=result;
        }
      }
    }
  }
 else   if (pathParts.size() == 3) {
    String filename=(String)pathParts.remove(0);
    int idx=filename.lastIndexOf('-');
    if (idx > 0) {
      String version=filename.substring(idx + 1);
      String artifactId=filename.substring(0,idx);
      String types=(String)pathParts.remove(0);
      String type=types.substring(0,types.length() - 1);
      String groupId=(String)pathParts.remove(0);
      artifact=artifactFactory.createArtifact(groupId,artifactId,version,Artifact.SCOPE_RUNTIME,type);
    }
  }
  return artifact;
}

Fixed version (ground truth):
public static Artifact buildArtifact(String path,ArtifactFactory artifactFactory){
  List pathParts=new ArrayList();
  StringTokenizer st=new StringTokenizer(path,"String_Node_Str");
  while (st.hasMoreTokens()) {
    pathParts.add(st.nextToken());
  }
  Collections.reverse(pathParts);
  Artifact artifact=null;
  if (pathParts.size() >= 4) {
    String filename=(String)pathParts.remove(0);
    String version=(String)pathParts.remove(0);
    String artifactId=(String)pathParts.remove(0);
    Collections.reverse(pathParts);
    String groupId=StringUtils.join(pathParts.iterator(),"String_Node_Str");
    String remainingFilename=filename;
    if (!remainingFilename.startsWith(artifactId + "String_Node_Str")) {
      return null;
    }
 else {
      remainingFilename=remainingFilename.substring(artifactId.length() + 1);
      String classifier=null;
      String type;
      if (remainingFilename.endsWith("String_Node_Str")) {
        type="String_Node_Str";
        remainingFilename=remainingFilename.substring(0,remainingFilename.length() - "String_Node_Str".length());
      }
 else       if (remainingFilename.endsWith("String_Node_Str")) {
        type="String_Node_Str";
        remainingFilename=remainingFilename.substring(0,remainingFilename.length() - "String_Node_Str".length());
      }
 else       if (remainingFilename.endsWith("String_Node_Str")) {
        type="String_Node_Str";
        classifier="String_Node_Str";
        remainingFilename=remainingFilename.substring(0,remainingFilename.length() - "String_Node_Str".length());
      }
 else {
        int index=remainingFilename.lastIndexOf("String_Node_Str");
        if (index < 0) {
          return null;
        }
 else {
          type=remainingFilename.substring(index + 1);
          remainingFilename=remainingFilename.substring(0,index);
        }
      }
      if (type != null) {
        Artifact result;
        if (classifier == null) {
          result=artifactFactory.createArtifact(groupId,artifactId,version,Artifact.SCOPE_RUNTIME,type);
        }
 else {
          result=artifactFactory.createArtifactWithClassifier(groupId,artifactId,version,type,classifier);
        }
        if (result.isSnapshot()) {
          int classifierIndex=remainingFilename.indexOf('-',version.length() + 8);
          if (classifierIndex >= 0) {
            classifier=remainingFilename.substring(classifierIndex + 1);
            remainingFilename=remainingFilename.substring(0,classifierIndex);
            result=artifactFactory.createArtifactWithClassifier(groupId,artifactId,remainingFilename,type,classifier);
          }
 else {
            result=artifactFactory.createArtifact(groupId,artifactId,remainingFilename,Artifact.SCOPE_RUNTIME,type);
          }
          if (!result.isSnapshot()) {
            return null;
          }
 else           if (!result.getBaseVersion().equals(version)) {
            return null;
          }
 else {
            artifact=result;
          }
        }
 else         if (!remainingFilename.startsWith(version)) {
          return null;
        }
 else         if (!remainingFilename.equals(version)) {
          if (remainingFilename.charAt(version.length()) != '-') {
            return null;
          }
 else {
            classifier=remainingFilename.substring(version.length() + 1);
            artifact=artifactFactory.createArtifactWithClassifier(groupId,artifactId,version,type,classifier);
          }
        }
 else {
          artifact=result;
        }
      }
    }
  }
 else   if (pathParts.size() == 3) {
    String filename=(String)pathParts.remove(0);
    int idx=filename.lastIndexOf('-');
    if (idx > 0) {
      String extension=filename.substring(filename.lastIndexOf('.') + 1);
      String version=filename.substring(idx + 1,filename.lastIndexOf('.'));
      String artifactId=filename.substring(0,idx);
      String types=(String)pathParts.remove(0);
      String type=types.substring(0,types.length() - 1);
      if (type.equals(extension)) {
        String groupId=(String)pathParts.remove(0);
        artifact=artifactFactory.createArtifact(groupId,artifactId,version,Artifact.SCOPE_RUNTIME,type);
      }
    }
  }
  return artifact;
}