Program: 3395
Project: 3395
Buggy source:
/** 
 * Set up the bitstream reader. See the class description for information on configuration options.
 */
public void setup(SourceResolver resolver,Map objectModel,String src,Parameters par) throws ProcessingException, SAXException, IOException {
  super.setup(resolver,objectModel,src,par);
  try {
    this.request=ObjectModelHelper.getRequest(objectModel);
    this.response=ObjectModelHelper.getResponse(objectModel);
    Context context=ContextUtil.obtainContext(objectModel);
    int itemID=par.getParameterAsInteger("String_Node_Str",-1);
    int bitstreamID=par.getParameterAsInteger("String_Node_Str",-1);
    String handle=par.getParameter("String_Node_Str",null);
    int sequence=par.getParameterAsInteger("String_Node_Str",-1);
    String name=par.getParameter("String_Node_Str",null);
    Bitstream bitstream=null;
    Item item=null;
    DSpaceObject dso=null;
    if (bitstreamID > -1) {
      bitstream=Bitstream.find(context,bitstreamID);
    }
 else     if (itemID > -1) {
      item=Item.find(context,itemID);
      if (sequence > -1) {
        bitstream=findBitstreamBySequence(item,sequence);
      }
 else       if (name != null) {
        bitstream=findBitstreamByName(item,name);
      }
    }
 else     if (handle != null) {
      dso=HandleManager.resolveToObject(context,handle);
      if (dso instanceof Item) {
        item=(Item)dso;
        if (sequence > -1) {
          bitstream=findBitstreamBySequence(item,sequence);
        }
 else         if (name != null) {
          bitstream=findBitstreamByName(item,name);
        }
      }
    }
    if (bitstream == null) {
      throw new ResourceNotFoundException("String_Node_Str");
    }
    boolean isAuthorized=AuthorizeManager.authorizeActionBoolean(context,bitstream,Constants.READ);
    if (item != null && item.isWithdrawn() && !AuthorizeManager.isAdmin(context)) {
      isAuthorized=false;
      log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + item.getHandle() + "String_Node_Str"));
    }
    if (!isAuthorized) {
      if (this.request.getSession().getAttribute("String_Node_Str") != null) {
        String redictURL=request.getContextPath() + "String_Node_Str";
        if (item != null) {
          redictURL+=item.getHandle();
        }
 else         if (dso != null) {
          redictURL+=dso.getHandle();
        }
        redictURL+="String_Node_Str" + bitstream.getID();
        HttpServletResponse httpResponse=(HttpServletResponse)objectModel.get(HttpEnvironment.HTTP_RESPONSE_OBJECT);
        httpResponse.sendRedirect(redictURL);
        return;
      }
 else {
        AuthenticationUtil.interruptRequest(objectModel,AUTH_REQUIRED_HEADER,AUTH_REQUIRED_MESSAGE,null);
        String redictURL=request.getContextPath() + "String_Node_Str";
        HttpServletResponse httpResponse=(HttpServletResponse)objectModel.get(HttpEnvironment.HTTP_RESPONSE_OBJECT);
        httpResponse.sendRedirect(redictURL);
        return;
      }
    }
    this.bitstreamInputStream=bitstream.retrieve();
    this.bitstreamSize=bitstream.getSize();
    this.bitstreamMimeType=bitstream.getFormat().getMIMEType();
    this.bitstreamName=bitstream.getName();
    if (bitstreamName != null) {
      int finalSlashIndex=bitstreamName.lastIndexOf("String_Node_Str");
      if (finalSlashIndex > 0) {
        bitstreamName=bitstreamName.substring(finalSlashIndex + 1);
      }
    }
    log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + bitstream.getID()));
  }
 catch (  SQLException sqle) {
    throw new ProcessingException("String_Node_Str",sqle);
  }
catch (  AuthorizeException ae) {
    throw new ProcessingException("String_Node_Str",ae);
  }
}

Fixed version (ground truth):
/** 
 * Set up the bitstream reader. See the class description for information on configuration options.
 */
public void setup(SourceResolver resolver,Map objectModel,String src,Parameters par) throws ProcessingException, SAXException, IOException {
  super.setup(resolver,objectModel,src,par);
  try {
    this.request=ObjectModelHelper.getRequest(objectModel);
    this.response=ObjectModelHelper.getResponse(objectModel);
    Context context=ContextUtil.obtainContext(objectModel);
    int itemID=par.getParameterAsInteger("String_Node_Str",-1);
    int bitstreamID=par.getParameterAsInteger("String_Node_Str",-1);
    String handle=par.getParameter("String_Node_Str",null);
    int sequence=par.getParameterAsInteger("String_Node_Str",-1);
    String name=par.getParameter("String_Node_Str",null);
    Bitstream bitstream=null;
    Item item=null;
    DSpaceObject dso=null;
    if (bitstreamID > -1) {
      bitstream=Bitstream.find(context,bitstreamID);
    }
 else     if (itemID > -1) {
      item=Item.find(context,itemID);
      if (sequence > -1) {
        bitstream=findBitstreamBySequence(item,sequence);
      }
 else       if (name != null) {
        bitstream=findBitstreamByName(item,name);
      }
    }
 else     if (handle != null) {
      dso=HandleManager.resolveToObject(context,handle);
      if (dso instanceof Item) {
        item=(Item)dso;
        if (sequence > -1) {
          bitstream=findBitstreamBySequence(item,sequence);
        }
 else         if (name != null) {
          bitstream=findBitstreamByName(item,name);
        }
      }
    }
    if (bitstream == null) {
      throw new ResourceNotFoundException("String_Node_Str");
    }
    boolean isAuthorized=AuthorizeManager.authorizeActionBoolean(context,bitstream,Constants.READ);
    if (item != null && item.isWithdrawn() && !AuthorizeManager.isAdmin(context)) {
      isAuthorized=false;
      log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + item.getHandle() + "String_Node_Str"));
    }
    if (!isAuthorized) {
      if (this.request.getSession().getAttribute("String_Node_Str") != null) {
        String redictURL=request.getContextPath() + "String_Node_Str";
        if (item != null) {
          redictURL+=item.getHandle();
        }
 else         if (dso != null) {
          redictURL+=dso.getHandle();
        }
        redictURL+="String_Node_Str" + bitstream.getID();
        HttpServletResponse httpResponse=(HttpServletResponse)objectModel.get(HttpEnvironment.HTTP_RESPONSE_OBJECT);
        httpResponse.sendRedirect(redictURL);
        return;
      }
 else {
        AuthenticationUtil.interruptRequest(objectModel,AUTH_REQUIRED_HEADER,AUTH_REQUIRED_MESSAGE,null);
        String redictURL=request.getContextPath() + "String_Node_Str";
        HttpServletResponse httpResponse=(HttpServletResponse)objectModel.get(HttpEnvironment.HTTP_RESPONSE_OBJECT);
        httpResponse.sendRedirect(redictURL);
        return;
      }
    }
    this.bitstreamInputStream=bitstream.retrieve();
    this.bitstreamSize=bitstream.getSize();
    this.bitstreamMimeType=bitstream.getFormat().getMIMEType();
    this.bitstreamName=bitstream.getName();
    if (bitstreamName != null && bitstreamName.length() > 0) {
      int finalSlashIndex=bitstreamName.lastIndexOf("String_Node_Str");
      if (finalSlashIndex > 0) {
        bitstreamName=bitstreamName.substring(finalSlashIndex + 1);
      }
    }
 else {
      bitstreamName="String_Node_Str";
    }
    log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + bitstream.getID()));
  }
 catch (  SQLException sqle) {
    throw new ProcessingException("String_Node_Str",sqle);
  }
catch (  AuthorizeException ae) {
    throw new ProcessingException("String_Node_Str",ae);
  }
}