Program: 52182
Project: 52182
Buggy source:
protected void doDSGet(Context context,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException {
  Bitstream bitstream=null;
  boolean displayLicense=ConfigurationManager.getBooleanProperty("String_Node_Str",false);
  boolean isLicense=false;
  String idString=request.getPathInfo();
  if (idString != null) {
    if (idString.startsWith("String_Node_Str")) {
      idString=idString.substring(1);
    }
    int slashIndex=idString.indexOf('/');
    if (slashIndex != -1) {
      idString=idString.substring(0,slashIndex);
    }
    try {
      int id=Integer.parseInt(idString);
      bitstream=Bitstream.find(context,id);
    }
 catch (    NumberFormatException nfe) {
    }
  }
  if (bitstream != null) {
    Bundle bundle=bitstream.getBundles()[0];
    if (bundle.getName().equals(Constants.LICENSE_BUNDLE_NAME) && bitstream.getName().equals(Constants.LICENSE_BITSTREAM_NAME)) {
      isLicense=true;
    }
    if (isLicense && !displayLicense && !AuthorizeManager.isAdmin(context)) {
      throw new AuthorizeException();
    }
    log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + bitstream.getID()));
    new DSpace().getEventService().fireEvent(new UsageEvent(UsageEvent.Action.VIEW,request,context,bitstream));
    InputStream is=bitstream.retrieve();
    response.setContentType(bitstream.getFormat().getMIMEType());
    response.setHeader("String_Node_Str",String.valueOf(bitstream.getSize()));
    if (threshold != -1 && bitstream.getSize() >= threshold) {
      UIUtil.setBitstreamDisposition(bitstream.getName(),request,response);
    }
    Utils.bufferedCopy(is,response.getOutputStream());
    is.close();
    response.getOutputStream().flush();
  }
 else {
    log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + idString));
    JSPManager.showInvalidIDError(request,response,idString,Constants.BITSTREAM);
  }
}

Fixed version (ground truth):
protected void doDSGet(Context context,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException {
  Bitstream bitstream=null;
  boolean displayLicense=ConfigurationManager.getBooleanProperty("String_Node_Str",false);
  boolean isLicense=false;
  String idString=request.getPathInfo();
  if (idString != null) {
    if (idString.startsWith("String_Node_Str")) {
      idString=idString.substring(1);
    }
    int slashIndex=idString.indexOf('/');
    if (slashIndex != -1) {
      idString=idString.substring(0,slashIndex);
    }
    try {
      int id=Integer.parseInt(idString);
      bitstream=Bitstream.find(context,id);
    }
 catch (    NumberFormatException nfe) {
    }
  }
  if (bitstream != null) {
    Bundle bundle=bitstream.getBundles().length > 0 ? bitstream.getBundles()[0] : null;
    if (bundle != null && bundle.getName().equals(Constants.LICENSE_BUNDLE_NAME) && bitstream.getName().equals(Constants.LICENSE_BITSTREAM_NAME)) {
      isLicense=true;
    }
    if (isLicense && !displayLicense && !AuthorizeManager.isAdmin(context)) {
      throw new AuthorizeException();
    }
    log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + bitstream.getID()));
    new DSpace().getEventService().fireEvent(new UsageEvent(UsageEvent.Action.VIEW,request,context,bitstream));
    InputStream is=bitstream.retrieve();
    response.setContentType(bitstream.getFormat().getMIMEType());
    response.setHeader("String_Node_Str",String.valueOf(bitstream.getSize()));
    if (threshold != -1 && bitstream.getSize() >= threshold) {
      UIUtil.setBitstreamDisposition(bitstream.getName(),request,response);
    }
    Utils.bufferedCopy(is,response.getOutputStream());
    is.close();
    response.getOutputStream().flush();
  }
 else {
    log.info(LogManager.getHeader(context,"String_Node_Str","String_Node_Str" + idString));
    JSPManager.showInvalidIDError(request,response,idString,Constants.BITSTREAM);
  }
}