Program: 52212
Project: 52212
Buggy source:
/** 
 * Create a new DSpace object out of a METS content package. All contents are dictated by the METS manifest. Package is a ZIP archive (or optionally bare manifest XML document). In a Zip, all files relative to top level and the manifest (as per spec) in mets.xml.
 * @param context  DSpace context.
 * @param parent parent under which to create new object(may be null -- in which case ingester must determine parent from package or throw an error).
 * @param pkgFile  The package file to ingest
 * @param params Properties-style list of options (interpreted by each packager).
 * @param license  may be null, which takes default license.
 * @return DSpaceObject created by ingest.
 * @throws PackageValidationException if package is unacceptable or there isa fatal error turning it into a DSpaceObject.
 * @throws CrosswalkException
 * @throws AuthorizeException
 * @throws SQLException
 * @throws IOException
 */
public DSpaceObject ingest(Context context,DSpaceObject parent,File pkgFile,PackageParameters params,String license) throws PackageValidationException, CrosswalkException, AuthorizeException, SQLException, IOException {
  METSManifest manifest=null;
  DSpaceObject dso=null;
  try {
    log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + pkgFile.getName()));
    manifest=parsePackage(context,pkgFile,params);
    if (manifest == null)     throw new PackageValidationException("String_Node_Str" + METSManifest.MANIFEST_FILE + "String_Node_Str");
    checkManifest(manifest);
    if (!params.restoreModeEnabled() && !params.containsKey("String_Node_Str")) {
      params.addProperty("String_Node_Str","String_Node_Str");
    }
    if (parent != null && !params.containsKey("String_Node_Str")) {
      params.addProperty("String_Node_Str","String_Node_Str");
    }
    dso=ingestObject(context,parent,manifest,pkgFile,params,license);
    String action="String_Node_Str";
    if (params.restoreModeEnabled())     action="String_Node_Str";
    log.info(LogManager.getHeader(context,action,"String_Node_Str" + Constants.typeText[dso.getType()] + "String_Node_Str"+ dso.getHandle()+ "String_Node_Str"+ String.valueOf(dso.getID())));
    if (params.recursiveModeEnabled()) {
      String[] childFilePaths=manifest.getChildMetsFilePaths();
      for (int i=0; i < childFilePaths.length; i++)       addPackageReference(dso,childFilePaths[i]);
    }
    return dso;
  }
 catch (  SQLException se) {
    dso=null;
    throw se;
  }
}

Fixed version (ground truth):
/** 
 * Create a new DSpace object out of a METS content package. All contents are dictated by the METS manifest. Package is a ZIP archive (or optionally bare manifest XML document). In a Zip, all files relative to top level and the manifest (as per spec) in mets.xml.
 * @param context  DSpace context.
 * @param parent parent under which to create new object(may be null -- in which case ingester must determine parent from package or throw an error).
 * @param pkgFile  The package file to ingest
 * @param params Properties-style list of options (interpreted by each packager).
 * @param license  may be null, which takes default license.
 * @return DSpaceObject created by ingest.
 * @throws PackageValidationException if package is unacceptable or there isa fatal error turning it into a DSpaceObject.
 * @throws CrosswalkException
 * @throws AuthorizeException
 * @throws SQLException
 * @throws IOException
 */
public DSpaceObject ingest(Context context,DSpaceObject parent,File pkgFile,PackageParameters params,String license) throws PackageValidationException, CrosswalkException, AuthorizeException, SQLException, IOException {
  METSManifest manifest=null;
  DSpaceObject dso=null;
  try {
    log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + pkgFile.getName()));
    manifest=parsePackage(context,pkgFile,params);
    if (manifest == null)     throw new PackageValidationException("String_Node_Str" + METSManifest.MANIFEST_FILE + "String_Node_Str");
    checkManifest(manifest);
    if (!params.restoreModeEnabled() && !params.containsKey("String_Node_Str")) {
      params.addProperty("String_Node_Str","String_Node_Str");
    }
    if (parent != null && !params.containsKey("String_Node_Str")) {
      params.addProperty("String_Node_Str","String_Node_Str");
    }
    int type=getObjectType(manifest);
    if (type == Constants.SITE) {
      dso=Site.find(context,Site.SITE_ID);
    }
 else {
      dso=ingestObject(context,parent,manifest,pkgFile,params,license);
      String action="String_Node_Str";
      if (params.restoreModeEnabled())       action="String_Node_Str";
      log.info(LogManager.getHeader(context,action,"String_Node_Str" + Constants.typeText[dso.getType()] + "String_Node_Str"+ dso.getHandle()+ "String_Node_Str"+ String.valueOf(dso.getID())));
    }
    if (params.recursiveModeEnabled()) {
      String[] childFilePaths=manifest.getChildMetsFilePaths();
      for (int i=0; i < childFilePaths.length; i++)       addPackageReference(dso,childFilePaths[i]);
    }
    return dso;
  }
 catch (  SQLException se) {
    dso=null;
    throw se;
  }
}