Program: 52515
Project: 52515
Buggy source:
/** 
 * Export the object (Item, Collection, or Community) to a package file on the indicated OutputStream. Gets an exception of the object cannot be packaged or there is a failure creating the package.
 * @param context - DSpace context.
 * @param dso - DSpace object (item, collection, etc)
 * @param pkg - output stream on which to write package
 * @throws PackageException if package cannot be created or there isa fatal error in creating it.
 */
public void disseminate(Context context,DSpaceObject dso,PackageParameters params,OutputStream pkg) throws PackageValidationException, CrosswalkException, AuthorizeException, SQLException, IOException {
  if (dso.getType() == Constants.ITEM) {
    Item item=(Item)dso;
    if (params != null && params.getProperty("String_Node_Str") != null) {
      extraFiles=null;
      writeManifest(context,item,params,pkg);
    }
 else {
      extraFiles=new HashMap();
      ZipOutputStream zip=new ZipOutputStream(pkg);
      zip.setComment("String_Node_Str");
      ZipEntry me=new ZipEntry(MANIFEST_FILE);
      zip.putNextEntry(me);
      writeManifest(context,item,params,zip);
      zip.closeEntry();
      Iterator fi=extraFiles.keySet().iterator();
      while (fi.hasNext()) {
        String fname=(String)fi.next();
        ZipEntry ze=new ZipEntry(fname);
        zip.putNextEntry(ze);
        Utils.copy((InputStream)extraFiles.get(fname),zip);
        zip.closeEntry();
      }
      Bundle bundles[]=item.getBundles();
      for (int i=0; i < bundles.length; i++) {
        if (!PackageUtils.isMetaInfoBundle(bundles[i])) {
          Bitstream[] bitstreams=bundles[i].getBitstreams();
          for (int k=0; k < bitstreams.length; k++) {
            if (AuthorizeManager.authorizeActionBoolean(context,bitstreams[k],Constants.READ)) {
              ZipEntry ze=new ZipEntry(makeBitstreamName(bitstreams[k]));
              ze.setSize(bitstreams[k].getSize());
              zip.putNextEntry(ze);
              Utils.copy(bitstreams[k].retrieve(),zip);
              zip.closeEntry();
            }
          }
        }
      }
      zip.close();
      extraFiles=null;
    }
  }
 else   throw new PackageValidationException("String_Node_Str");
}

Fixed version (ground truth):
/** 
 * Export the object (Item, Collection, or Community) to a package file on the indicated OutputStream. Gets an exception of the object cannot be packaged or there is a failure creating the package.
 * @param context - DSpace context.
 * @param dso - DSpace object (item, collection, etc)
 * @param pkg - output stream on which to write package
 * @throws PackageException if package cannot be created or there isa fatal error in creating it.
 */
public void disseminate(Context context,DSpaceObject dso,PackageParameters params,OutputStream pkg) throws PackageValidationException, CrosswalkException, AuthorizeException, SQLException, IOException {
  if (dso.getType() == Constants.ITEM) {
    Item item=(Item)dso;
    long lmTime=item.getLastModified().getTime();
    String unauth=(params == null) ? null : params.getProperty("String_Node_Str");
    if (params != null && params.getProperty("String_Node_Str") != null) {
      extraFiles=null;
      writeManifest(context,item,params,pkg);
    }
 else {
      extraFiles=new HashMap();
      ZipOutputStream zip=new ZipOutputStream(pkg);
      zip.setComment("String_Node_Str");
      ZipEntry me=new ZipEntry(MANIFEST_FILE);
      me.setTime(lmTime);
      zip.putNextEntry(me);
      writeManifest(context,item,params,zip);
      zip.closeEntry();
      Iterator fi=extraFiles.keySet().iterator();
      while (fi.hasNext()) {
        String fname=(String)fi.next();
        ZipEntry ze=new ZipEntry(fname);
        ze.setTime(lmTime);
        zip.putNextEntry(ze);
        Utils.copy((InputStream)extraFiles.get(fname),zip);
        zip.closeEntry();
      }
      Bundle bundles[]=item.getBundles();
      for (int i=0; i < bundles.length; i++) {
        if (!PackageUtils.isMetaInfoBundle(bundles[i])) {
          if (!AuthorizeManager.authorizeActionBoolean(context,bundles[i],Constants.READ)) {
            if (unauth != null && (unauth.equalsIgnoreCase("String_Node_Str"))) {
              log.warn("String_Node_Str" + bundles[i].getName() + "String_Node_Str");
              continue;
            }
 else             throw new AuthorizeException("String_Node_Str" + bundles[i].getName() + "String_Node_Str");
          }
          Bitstream[] bitstreams=bundles[i].getBitstreams();
          for (int k=0; k < bitstreams.length; k++) {
            boolean auth=AuthorizeManager.authorizeActionBoolean(context,bitstreams[k],Constants.READ);
            if (auth || (unauth != null && unauth.equalsIgnoreCase("String_Node_Str"))) {
              ZipEntry ze=new ZipEntry(makeBitstreamName(bitstreams[k]));
              ze.setTime(lmTime);
              ze.setSize(auth ? bitstreams[k].getSize() : 0);
              zip.putNextEntry(ze);
              if (auth)               Utils.copy(bitstreams[k].retrieve(),zip);
 else               log.warn("String_Node_Str" + String.valueOf(bitstreams[k].getSequenceID()) + "String_Node_Str");
              zip.closeEntry();
            }
 else             if (unauth != null && unauth.equalsIgnoreCase("String_Node_Str")) {
              log.warn("String_Node_Str" + String.valueOf(bitstreams[k].getSequenceID()) + "String_Node_Str");
            }
 else {
              throw new AuthorizeException("String_Node_Str" + String.valueOf(bitstreams[k].getSequenceID()));
            }
          }
        }
      }
      zip.close();
      extraFiles=null;
    }
  }
 else   throw new PackageValidationException("String_Node_Str");
}