Program: 19532
Project: 19532
Buggy source:
@Override public void onDeleted(AbstractBuild build){
  FreeStyleProject freeStyleProject;
  if (!(build.getProject() instanceof FreeStyleProject)) {
    return;
  }
  freeStyleProject=(FreeStyleProject)build.getProject();
  DescribableList<Builder,Descriptor<Builder>> projectBuilders=freeStyleProject.getBuildersList();
  Iterator<Builder> it=projectBuilders.iterator();
  List<ArtifactDeployerBuilder> artifactDeployerBuilders=new ArrayList<ArtifactDeployerBuilder>();
  while (it.hasNext()) {
    Builder builder=it.next();
    if (DescriptorImpl.DISPLAY_NAME.equals(builder.getDescriptor().getDisplayName())) {
      ArtifactDeployerBuilder instance=(ArtifactDeployerBuilder)builder;
      artifactDeployerBuilders.add(instance);
    }
  }
  for (  ArtifactDeployerBuilder artifactDeployerBuilder : artifactDeployerBuilders) {
    DeployedArtifacts deployedArtifacts=build.getAction(DeployedArtifacts.class);
    Map<Integer,List<ArtifactDeployerVO>> info=deployedArtifacts.getDeployedArtifactsInfo();
    if (info != null) {
      ArtifactDeployerEntry entry=artifactDeployerBuilder.getEntry();
      if (entry.isDeleteRemoteArtifacts()) {
        List<ArtifactDeployerVO> listArtifacts=info.get(entry.getUniqueId());
        for (        ArtifactDeployerVO vo : listArtifacts) {
          FilePath remoteArtifactPath=new FilePath(build.getWorkspace().getChannel(),vo.getRemotePath());
          try {
            if (remoteArtifactPath.exists()) {
              remoteArtifactPath.deleteRecursive();
            }
            if (remoteArtifactPath.getParent().exists() && remoteArtifactPath.getParent().list().size() == 0) {
              remoteArtifactPath.getParent().delete();
            }
          }
 catch (          IOException ioe) {
            logger.log(Level.SEVERE,"String_Node_Str",ioe);
          }
catch (          InterruptedException ie) {
            logger.log(Level.SEVERE,"String_Node_Str",ie);
          }
        }
      }
      if (entry.isDeleteRemoteArtifactsByScript()) {
        Binding binding=new Binding();
        if (deployedArtifacts != null) {
          List<ArtifactDeployerVO> listArtifacts=info.get(entry.getUniqueId());
          binding.setVariable("String_Node_Str",listArtifacts);
        }
        GroovyShell shell=new GroovyShell(binding);
        shell.evaluate(entry.getGroovyExpression());
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onDeleted(AbstractBuild build){
  FreeStyleProject freeStyleProject;
  if (!(build.getProject() instanceof FreeStyleProject)) {
    return;
  }
  freeStyleProject=(FreeStyleProject)build.getProject();
  DescribableList<Builder,Descriptor<Builder>> projectBuilders=freeStyleProject.getBuildersList();
  Iterator<Builder> it=projectBuilders.iterator();
  List<ArtifactDeployerBuilder> artifactDeployerBuilders=new ArrayList<ArtifactDeployerBuilder>();
  while (it.hasNext()) {
    Builder builder=it.next();
    if (DescriptorImpl.DISPLAY_NAME.equals(builder.getDescriptor().getDisplayName())) {
      ArtifactDeployerBuilder instance=(ArtifactDeployerBuilder)builder;
      artifactDeployerBuilders.add(instance);
    }
  }
  for (  ArtifactDeployerBuilder artifactDeployerBuilder : artifactDeployerBuilders) {
    DeployedArtifacts deployedArtifacts=build.getAction(DeployedArtifacts.class);
    if (deployedArtifacts != null) {
      Map<Integer,List<ArtifactDeployerVO>> info=deployedArtifacts.getDeployedArtifactsInfo();
      if (info != null) {
        ArtifactDeployerEntry entry=artifactDeployerBuilder.getEntry();
        if (entry.isDeleteRemoteArtifacts()) {
          List<ArtifactDeployerVO> listArtifacts=info.get(entry.getUniqueId());
          if (listArtifacts != null) {
            for (            ArtifactDeployerVO vo : listArtifacts) {
              FilePath remoteArtifactPath=new FilePath(build.getWorkspace().getChannel(),vo.getRemotePath());
              try {
                if (remoteArtifactPath.exists()) {
                  remoteArtifactPath.deleteRecursive();
                }
                if (remoteArtifactPath.getParent().exists() && remoteArtifactPath.getParent().list().size() == 0) {
                  remoteArtifactPath.getParent().delete();
                }
              }
 catch (              IOException ioe) {
                logger.log(Level.SEVERE,"String_Node_Str",ioe);
              }
catch (              InterruptedException ie) {
                logger.log(Level.SEVERE,"String_Node_Str",ie);
              }
            }
          }
        }
        if (entry.isDeleteRemoteArtifactsByScript()) {
          Binding binding=new Binding();
          if (deployedArtifacts != null) {
            List<ArtifactDeployerVO> listArtifacts=info.get(entry.getUniqueId());
            binding.setVariable("String_Node_Str",listArtifacts);
          }
          GroovyShell shell=new GroovyShell(binding);
          shell.evaluate(entry.getGroovyExpression());
        }
      }
    }
  }
}