Program: 52067
Project: 52067
Buggy source:
public void run(){
  Context context=null;
  String importDir=null;
  try {
    context=new Context();
    context.setCurrentUser(eperson);
    context.setIgnoreAuthorization(true);
    InputStream is=new URL(zipurl).openStream();
    importDir=ConfigurationManager.getProperty("String_Node_Str") + File.separator + "String_Node_Str"+ File.separator+ context.getCurrentUser().getID()+ File.separator+ resumePath;
    File importDirFile=new File(importDir);
    if (!importDirFile.exists()) {
      boolean success=importDirFile.mkdirs();
      if (!success) {
        log.info("String_Node_Str");
        throw new Exception("String_Node_Str");
      }
    }
    String dataZipPath=importDirFile + File.separator + "String_Node_Str";
    String dataZipDir=importDirFile + File.separator + "String_Node_Str"+ File.separator;
    (new File(dataZipPath)).delete();
    (new File(dataZipDir)).delete();
    OutputStream os=new FileOutputStream(dataZipPath);
    byte[] b=new byte[2048];
    int length;
    while ((length=is.read(b)) != -1) {
      os.write(b,0,length);
    }
    is.close();
    os.close();
    ZipFile zf=new ZipFile(dataZipPath);
    ZipEntry entry;
    Enumeration<? extends ZipEntry> entries=zf.entries();
    while (entries.hasMoreElements()) {
      entry=entries.nextElement();
      if (entry.isDirectory()) {
        if (!new File(dataZipDir + entry.getName()).mkdir()) {
          log.error("String_Node_Str");
        }
      }
 else {
        int index=entry.getName().lastIndexOf('/');
        if (index == -1) {
          index=entry.getName().lastIndexOf('\\');
        }
        if (index > 0) {
          File dir=new File(dataZipDir + entry.getName().substring(0,index));
          if (!dir.mkdirs()) {
            log.error("String_Node_Str");
          }
        }
        byte[] buffer=new byte[1024];
        int len;
        InputStream in=zf.getInputStream(entry);
        BufferedOutputStream out=new BufferedOutputStream(new FileOutputStream(dataZipDir + entry.getName()));
        while ((len=in.read(buffer)) >= 0) {
          out.write(buffer,0,len);
        }
        in.close();
        out.close();
      }
    }
    zf.close();
    String sourcePath=dataZipDir;
    String mapFilePath=importDirFile + File.separator + "String_Node_Str";
    ItemImport myloader=new ItemImport();
    myloader.isResume=true;
    Collection[] finalCollections=null;
    if (theOwningCollection != null) {
      finalCollections=new Collection[otherCollections.length + 1];
      finalCollections[0]=theOwningCollection;
      for (int i=0; i < otherCollections.length; i++) {
        finalCollections[i + 1]=otherCollections[i];
      }
    }
    myloader.addItems(context,finalCollections,sourcePath,mapFilePath,template);
    emailSuccessMessage(context,eperson,mapFilePath);
    context.complete();
  }
 catch (  Exception e) {
    e.printStackTrace();
    if (mapOut != null) {
      mapOut.close();
    }
    mapOut=null;
    if (importDir != null) {
    }
    try {
      emailErrorMessage(eperson,e.getMessage());
      throw new Exception(e.getMessage());
    }
 catch (    Exception e2) {
    }
  }
 finally {
    if (mapOut != null) {
      mapOut.close();
    }
    try {
      context.complete();
    }
 catch (    SQLException sqle) {
      context.abort();
    }
  }
}

Fixed version (ground truth):
public void run(){
  Context context=null;
  String importDir=null;
  try {
    context=new Context();
    context.setCurrentUser(eperson);
    context.setIgnoreAuthorization(true);
    List<Collection> collectionList=new ArrayList<Collection>();
    if (otherCollections2 != null) {
      for (      String colID : otherCollections2) {
        int colId=Integer.parseInt(colID);
        if (colId != theOwningCollection.getID()) {
          Collection col=Collection.find(context,colId);
          if (col != null) {
            collectionList.add(col);
          }
        }
      }
    }
    Collection[] otherCollections=collectionList.toArray(new Collection[collectionList.size()]);
    InputStream is=new URL(zipurl).openStream();
    importDir=ConfigurationManager.getProperty("String_Node_Str") + File.separator + "String_Node_Str"+ File.separator+ context.getCurrentUser().getID()+ File.separator+ resumePath;
    File importDirFile=new File(importDir);
    if (!importDirFile.exists()) {
      boolean success=importDirFile.mkdirs();
      if (!success) {
        log.info("String_Node_Str");
        throw new Exception("String_Node_Str");
      }
    }
    String dataZipPath=importDirFile + File.separator + "String_Node_Str";
    String dataZipDir=importDirFile + File.separator + "String_Node_Str"+ File.separator;
    (new File(dataZipPath)).delete();
    (new File(dataZipDir)).delete();
    OutputStream os=new FileOutputStream(dataZipPath);
    byte[] b=new byte[2048];
    int length;
    while ((length=is.read(b)) != -1) {
      os.write(b,0,length);
    }
    is.close();
    os.close();
    ZipFile zf=new ZipFile(dataZipPath);
    ZipEntry entry;
    Enumeration<? extends ZipEntry> entries=zf.entries();
    while (entries.hasMoreElements()) {
      entry=entries.nextElement();
      if (entry.isDirectory()) {
        if (!new File(dataZipDir + entry.getName()).mkdir()) {
          log.error("String_Node_Str");
        }
      }
 else {
        int index=entry.getName().lastIndexOf('/');
        if (index == -1) {
          index=entry.getName().lastIndexOf('\\');
        }
        if (index > 0) {
          File dir=new File(dataZipDir + entry.getName().substring(0,index));
          if (!dir.mkdirs()) {
            log.error("String_Node_Str");
          }
        }
        byte[] buffer=new byte[1024];
        int len;
        InputStream in=zf.getInputStream(entry);
        BufferedOutputStream out=new BufferedOutputStream(new FileOutputStream(dataZipDir + entry.getName()));
        while ((len=in.read(buffer)) >= 0) {
          out.write(buffer,0,len);
        }
        in.close();
        out.close();
      }
    }
    zf.close();
    String sourcePath=dataZipDir;
    String mapFilePath=importDirFile + File.separator + "String_Node_Str";
    ItemImport myloader=new ItemImport();
    myloader.isResume=true;
    Collection[] finalCollections=null;
    if (theOwningCollection != null) {
      finalCollections=new Collection[otherCollections.length + 1];
      finalCollections[0]=theOwningCollection;
      for (int i=0; i < otherCollections.length; i++) {
        finalCollections[i + 1]=otherCollections[i];
      }
    }
    myloader.addItems(context,finalCollections,sourcePath,mapFilePath,template);
    emailSuccessMessage(context,eperson,mapFilePath);
    context.complete();
  }
 catch (  Exception e) {
    e.printStackTrace();
    if (mapOut != null) {
      mapOut.close();
    }
    mapOut=null;
    if (importDir != null) {
    }
    try {
      emailErrorMessage(eperson,e.getMessage());
      throw new Exception(e.getMessage());
    }
 catch (    Exception e2) {
    }
  }
 finally {
    if (mapOut != null) {
      mapOut.close();
    }
    try {
      context.complete();
    }
 catch (    SQLException sqle) {
      context.abort();
    }
  }
}