Program: 151577
Project: 151577
Buggy source:
private void buildFromCurrentProject(final ShellPrintWriter out,final DirectoryResource buildDir) throws Abort {
  DirectoryResource savedLocation=shell.getCurrentDirectory();
  try {
    shell.setCurrentResource(buildDir);
    Project project=shell.getCurrentProject();
    if (project == null) {
      throw new IllegalStateException("String_Node_Str" + buildDir.getFullyQualifiedName() + "String_Node_Str");
    }
    DependencyFacet deps=project.getFacet(DependencyFacet.class);
    DependencyBuilder shellApi=DependencyBuilder.create("String_Node_Str");
    String apiVersion=null;
    if (!deps.hasEffectiveDependency(shellApi) && !prompt.promptBoolean("String_Node_Str",false)) {
      throw new Abort("String_Node_Str");
    }
 else {
      if (apiVersion == null) {
        Dependency directDependency=deps.getDirectDependency(shellApi);
        if ((directDependency != null) && !Strings.isNullOrEmpty(directDependency.getVersion()))         apiVersion=directDependency.getVersion();
      }
      if (apiVersion == null) {
        Dependency managedDependency=deps.getManagedDependency(shellApi);
        if ((managedDependency != null) && !Strings.isNullOrEmpty(managedDependency.getVersion()))         apiVersion=managedDependency.getVersion();
      }
      if (apiVersion == null) {
        Dependency effectiveDependency=deps.getEffectiveDependency(shellApi);
        if (effectiveDependency != null)         apiVersion=effectiveDependency.getVersion();
 else         apiVersion=environment.getRuntimeVersion();
      }
    }
    List<String> groupIds=Arrays.asList("String_Node_Str","String_Node_Str");
    List<Dependency> dependencies=deps.getDependencies();
    for (    Dependency dependency : dependencies) {
      if (groupIds.contains(dependency.getGroupId()) && !(ScopeType.PROVIDED.equals(dependency.getScopeTypeEnum()) || ScopeType.TEST.equals(dependency.getScopeTypeEnum()))) {
        ShellMessages.warn(out,"String_Node_Str" + dependency.toCoordinates() + "String_Node_Str");
        deps.addDirectDependency(DependencyBuilder.create(dependency).setScopeType(ScopeType.PROVIDED));
      }
    }
    ShellMessages.info(out,"String_Node_Str");
    Resource<?> artifact=project.getFacet(PackagingFacet.class).createBuilder().runTests(false).build();
    if ((artifact != null) && artifact.exists()) {
      MetadataFacet meta=project.getFacet(MetadataFacet.class);
      Dependency dep=meta.getOutputDependency();
      ShellMessages.info(out,"String_Node_Str");
      createModule(project,DependencyBuilder.create(dep).setVersion(dep.getVersion() + "String_Node_Str" + UUID.randomUUID().toString()),artifact,apiVersion);
    }
 else {
      throw new IllegalStateException("String_Node_Str" + artifact.getFullyQualifiedName() + "String_Node_Str");
    }
  }
  finally {
    shell.setCurrentResource(savedLocation);
  }
}

Fixed version (ground truth):
private void buildFromCurrentProject(final PipeOut out,final DirectoryResource buildDir) throws Abort {
  DirectoryResource savedLocation=shell.getCurrentDirectory();
  try {
    shell.setCurrentResource(buildDir);
    Project project=shell.getCurrentProject();
    if (project == null) {
      throw new IllegalStateException("String_Node_Str" + buildDir.getFullyQualifiedName() + "String_Node_Str");
    }
    DependencyFacet deps=project.getFacet(DependencyFacet.class);
    DependencyBuilder shellApi=DependencyBuilder.create("String_Node_Str");
    String apiVersion=null;
    if (!deps.hasEffectiveDependency(shellApi) && !prompt.promptBoolean("String_Node_Str",false)) {
      throw new Abort("String_Node_Str");
    }
 else {
      if (apiVersion == null) {
        Dependency directDependency=deps.getDirectDependency(shellApi);
        if ((directDependency != null) && !Strings.isNullOrEmpty(directDependency.getVersion()))         apiVersion=directDependency.getVersion();
      }
      if (apiVersion == null) {
        Dependency managedDependency=deps.getManagedDependency(shellApi);
        if ((managedDependency != null) && !Strings.isNullOrEmpty(managedDependency.getVersion()))         apiVersion=managedDependency.getVersion();
      }
      if (apiVersion == null) {
        Dependency effectiveDependency=deps.getEffectiveDependency(shellApi);
        if (effectiveDependency != null)         apiVersion=effectiveDependency.getVersion();
 else         apiVersion=environment.getRuntimeVersion();
      }
    }
    List<String> groupIds=Arrays.asList("String_Node_Str","String_Node_Str");
    List<Dependency> dependencies=deps.getDependencies();
    for (    Dependency dependency : dependencies) {
      if (groupIds.contains(dependency.getGroupId()) && !(ScopeType.PROVIDED.equals(dependency.getScopeTypeEnum()) || ScopeType.TEST.equals(dependency.getScopeTypeEnum()))) {
        ShellMessages.warn(out,"String_Node_Str" + dependency.toCoordinates() + "String_Node_Str");
        deps.addDirectDependency(DependencyBuilder.create(dependency).setScopeType(ScopeType.PROVIDED));
      }
    }
    ShellMessages.info(out,"String_Node_Str");
    Resource<?> artifact=project.getFacet(PackagingFacet.class).createBuilder().runTests(false).build();
    if ((artifact != null) && artifact.exists()) {
      MetadataFacet meta=project.getFacet(MetadataFacet.class);
      Dependency dep=meta.getOutputDependency();
      ShellMessages.info(out,"String_Node_Str");
      createModule(project,DependencyBuilder.create(dep).setVersion(dep.getVersion() + "String_Node_Str" + UUID.randomUUID().toString()),artifact,apiVersion);
    }
 else {
      throw new IllegalStateException("String_Node_Str" + artifact.getFullyQualifiedName() + "String_Node_Str");
    }
  }
  finally {
    shell.setCurrentResource(savedLocation);
  }
}