示例#1
0
  /* (non-Javadoc)
   * @see javax.servlet.http.HttpServlet#doPost(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
   */
  @Override
  protected void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    Author user = (Author) req.getSession().getAttribute("user");
    try {
      int hotelId = Integer.parseInt(req.getParameter("hotelId"));
      if (user != null) {
        String headline = req.getParameter("headline");
        String description = req.getParameter("description");
        int rating = Integer.parseInt(req.getParameter("rating"));

        if (!headline.equals("") && !description.equals("")) {
          Review review =
              new Review(0, hotelId, user.getId(), rating, new Date(), headline, description);
          Service service = new Service();
          service.addReview(review);
          resp.sendRedirect("hotel.jsp?id=" + hotelId + "&success=Successfully posted review!");
        } else {
          resp.sendRedirect(
              "hotel.jsp?id="
                  + hotelId
                  + "&msg=Please write something, mate. I don't like blank reviews");
        }
      } else {
        resp.sendRedirect("hotel.jsp?id=" + hotelId + "&msg=Please Login to post a review.");
      }
    } catch (NumberFormatException e) {
      resp.sendRedirect("error.jsp?msg=" + e.getLocalizedMessage());
    }
  }
示例#2
0
  public RuleResult runRule(
      Document aggregation,
      Object rightsHolders,
      BasicBSONList affiliations,
      Document preferences,
      Document statsDocument,
      Document profile,
      Object context) {
    RuleResult result = new RuleResult();

    try {

      long max = Long.parseLong(statsDocument.getString("Total Size"));
      long repoMax = Long.parseLong(profile.getString("Total Size"));
      if (max > repoMax) {
        result.setResult(-1, "Total size exceeds maximum allowed (" + repoMax + ").");
      } else {
        result.setResult(1, "Total size is acceptable (<=" + repoMax + ").");
      }
    } catch (NullPointerException npe) {
      // Just return untriggered result
      System.out.println("Missing info in TotalSize rule" + npe.getLocalizedMessage());
    } catch (NumberFormatException nfe) {
      // Just return untriggered result
      System.out.println(
          "Missing info in MaxDatasetSize rule for repo: "
              + profile.getString("orgidentifier")
              + " : "
              + nfe.getLocalizedMessage());
    }
    return result;
  }
  public int getPageForFacet(String facetName) {
    if (facetName == null) {
      throw new NullPointerException();
    }

    int newPage = 1;
    int pageCount = getPageCount();

    if (FIRST_FACET_NAME.equals(facetName)) {
      newPage = 1;
    } else if (LAST_FACET_NAME.equals(facetName)) {
      newPage = pageCount > 0 ? pageCount : 1;
    } else if (PREVIOUS_FACET_NAME.equals(facetName)) {
      newPage = getPage() - 1;
    } else if (NEXT_FACET_NAME.equals(facetName)) {
      newPage = getPage() + 1;
    } else if (FAST_FORWARD_FACET_NAME.equals(facetName)) {
      newPage = getPage() + getFastStepOrDefault();
    } else if (FAST_REWIND_FACET_NAME.equals(facetName)) {
      newPage = getPage() - getFastStepOrDefault();
    } else {
      try {
        newPage = Integer.parseInt(facetName.toString());
      } catch (NumberFormatException e) {
        throw new FacesException(e.getLocalizedMessage(), e);
      }
    }

    if (newPage >= 1 && newPage <= pageCount) {
      return newPage;
    } else {
      return 0;
    }
  }
 public long getLong(String key) throws DbusEventBufferMetaInfo.DbusEventBufferMetaInfoException {
   long l;
   try {
     l = Long.parseLong(getVal(key));
   } catch (NumberFormatException e) {
     throw new DbusEventBufferMetaInfo.DbusEventBufferMetaInfoException(
         this, "key=" + key + " msg= " + e.getLocalizedMessage());
   }
   return l;
 }
 public int getInt(String key) throws DbusEventBufferMetaInfo.DbusEventBufferMetaInfoException {
   int i;
   try {
     i = Integer.parseInt(getVal(key));
   } catch (NumberFormatException e) {
     throw new DbusEventBufferMetaInfo.DbusEventBufferMetaInfoException(
         this, e.getLocalizedMessage());
   }
   return i;
 }
  private int extractBadgeCount(Bundle extras) {
    int count = -1;
    String msgcnt = extras.getString(COUNT);

    try {
      if (msgcnt != null) {
        count = Integer.parseInt(msgcnt);
      }
    } catch (NumberFormatException e) {
      Log.e(LOG_TAG, e.getLocalizedMessage(), e);
    }

    return count;
  }
示例#7
0
  /**
   * Read and normalize evaluator datasets
   *
   * @throws IOException Data not correct
   * @throws NumberFormatException Format of data not correct
   */
  public void readData() throws IOException, NumberFormatException {

    // Read trainData
    try {
      unscaledTrainData.read();
    } catch (IOException e) {
      throw new IOException("trainData IOException: " + e.getLocalizedMessage());
    } catch (NumberFormatException e) {
      throw new NumberFormatException(
          "trainData NumberFormatException: " + e.getLocalizedMessage());
    }

    // Read testData
    try {
      unscaledTestData.read();
    } catch (IOException e) {
      throw new IOException("testData IOException: " + e.getLocalizedMessage());
    } catch (NumberFormatException e) {
      throw new NumberFormatException("testData NumberFormatException: " + e.getLocalizedMessage());
    }

    normalizeData();
  }
示例#8
0
 private void okSelected(TableItem[] items, String key, Map<String, Double> values) {
   for (TableItem item : items) {
     if (item.getText(0).length() == 0 && item.getText(1).length() > 0)
       throw new RuntimeException(
           RedisClient.i18nFile.getText(I18nFile.SCOREERROR) + item.getText(1));
     if ((item.getText(0).length() > 0))
       try {
         values.put(item.getText(1), Double.valueOf(item.getText(0)));
       } catch (NumberFormatException e) {
         throw new RuntimeException(
             RedisClient.i18nFile.getText(I18nFile.SCOREERROR) + e.getLocalizedMessage());
       }
   }
   setResult(new ZSetInfo(key, values, dataContent.getTTL()));
   shell.dispose();
 }
 BufferInfo(String fromString)
     throws
         DbusEventBufferMetaInfo
             .DbusEventBufferMetaInfoException { // string format is "pos,limit,capacity"
   String[] info = fromString.split(DELIMITER);
   if (info.length != 3)
     throw new DbusEventBufferMetaInfo.DbusEventBufferMetaInfoException(
         "parsing BufferInfo failed for " + fromString);
   try {
     _pos = Integer.parseInt(info[0]);
     _limit = Integer.parseInt(info[1]);
     _cap = Integer.parseInt(info[2]);
   } catch (NumberFormatException e) {
     throw new DbusEventBufferMetaInfo.DbusEventBufferMetaInfoException(
         "parsing BufferInfo failed for " + fromString + " " + e.getLocalizedMessage());
   }
 }
示例#10
0
  /**
   * Decodes data encoded using {@link #toHex(byte[],int,int) toHex}.
   *
   * @param hex data to be converted
   * @param start offset
   * @param len count
   * @throws IOException if input does not represent hex encoded value
   * @since 1.29
   */
  public static byte[] fromHex(char[] hex, int start, int len) throws IOException {

    if (hex == null) throw new IOException("null");

    int i = hex.length;
    if (i % 2 != 0) throw new IOException("odd length");
    byte[] magic = new byte[i / 2];
    for (; i > 0; i -= 2) {
      String g = new String(hex, i - 2, 2);
      try {
        magic[(i / 2) - 1] = (byte) Integer.parseInt(g, 16);
      } catch (NumberFormatException ex) {
        throw new IOException(ex.getLocalizedMessage());
      }
    }

    return magic;
  }
 public RasterSymbolizer(final org.opengis.style.RasterSymbolizer symbolizer) {
   ensureNonNull("symbolizer", symbolizer);
   name = symbolizer.getName();
   final Expression opacityExp = symbolizer.getOpacity();
   if (opacityExp != null) {
     final String opacityStr = CQL.write(opacityExp);
     try {
       opacity = Double.parseDouble(opacityStr);
     } catch (NumberFormatException ex) {
       LOGGER.log(Level.WARNING, ex.getLocalizedMessage(), ex);
     }
   }
   if (symbolizer.getChannelSelection() != null) {
     this.channelSelection = new ChannelSelection(symbolizer.getChannelSelection());
   }
   if (symbolizer.getColorMap() != null) {
     this.colorMap = new ColorMap(symbolizer.getColorMap());
   }
 }
  /**
   * Read the wishlist from a file and return it as an ArrayList<MtgCard>
   *
   * @param mCtx A context to open the file and pop toasts with
   * @return The wishlist in ArrayList form
   */
  public static ArrayList<MtgCard> ReadWishlist(Context mCtx) {

    ArrayList<MtgCard> lWishlist = new ArrayList<>();

    try {
      String line;
      BufferedReader br =
          new BufferedReader(new InputStreamReader(mCtx.openFileInput(WISHLIST_NAME)));
      /* Read each line as a card, and add them to the ArrayList */
      while ((line = br.readLine()) != null) {
        lWishlist.add(new MtgCard(line, mCtx));
      }
    } catch (NumberFormatException e) {
      ToastWrapper.makeText(mCtx, e.getLocalizedMessage(), ToastWrapper.LENGTH_LONG).show();
    } catch (IOException e) {
      /* Catches file not found exception when wishlist doesn't exist */
    }
    return lWishlist;
  }
示例#13
0
  /**
   * Deserialize the message from a String
   *
   * @param strMessage
   */
  public NetworkMessage(String fromIP, String[] messageArgs) {
    // break the nodeNumber out of the fromIP
    if (!fromIP.startsWith(Config.SUBNET)) {
      System.err.println("Got a message with an unknown subnet: " + fromIP);
      return;
    }

    if (messageArgs.length < 2)
      System.err.println(
          "Bad message format: Got " + messageArgs.length + " arguments, expected 2");

    try {
      timestamp = Long.parseLong(messageArgs[0]);
      from = Integer.parseInt(messageArgs[1]);
    } catch (NumberFormatException e) {
      System.err.println("Bad message format: " + e.getLocalizedMessage());
      e.printStackTrace();
    }

    data = Utils.arrayCopy(messageArgs, 2, messageArgs.length);
  }
  /**
   * reads cap, pos and limit for each buffer
   *
   * @return
   * @throws DbusEventBufferMetaInfo.DbusEventBufferMetaInfoException
   */
  public DbusEventBufferMetaInfo.BufferInfo[] getBuffersInfo()
      throws DbusEventBufferMetaInfo.DbusEventBufferMetaInfoException {
    int bufNum = 0;
    try {
      bufNum = Integer.parseInt(_info.get("ByteBufferNum"));
    } catch (NumberFormatException e) {
      throw new DbusEventBufferMetaInfo.DbusEventBufferMetaInfoException(
          this, e.getLocalizedMessage());
    }
    String bufInfoAll = _info.get("ByteBufferInfo");

    String[] buffersInfo = bufInfoAll.split(" ");
    if (buffersInfo.length != bufNum) {
      throw new DbusEventBufferMetaInfo.DbusEventBufferMetaInfoException(
          this, "bufNum " + bufNum + " doesn't match bufInfo size [" + bufInfoAll + "]");
    }
    DbusEventBufferMetaInfo.BufferInfo[] bInfos = new DbusEventBufferMetaInfo.BufferInfo[bufNum];
    for (int i = 0; i < buffersInfo.length; i++) {
      bInfos[i] = new DbusEventBufferMetaInfo.BufferInfo(buffersInfo[i]);
    }
    return bInfos;
  }
示例#15
0
  /** Parse the command line arguments and initialize the data */
  protected int parseArgs(boolean runAsMapReduce, String[] args) throws IOException {
    try {
      for (int i = 0; i < args.length; i++) { // parse command line
        if (args[i].equals("-scriptFile")) {
          scriptFile = args[++i];
          if (durations[0] > 0) {
            System.err.println("Can't specify elapsedTime and use script.");
            return -1;
          }
        } else if (args[i].equals("-readProbability")) {
          if (scriptFile != null) {
            System.err.println("Can't specify probabilities and use script.");
            return -1;
          }
          readProbs[0] = Double.parseDouble(args[++i]);
          if (readProbs[0] < 0 || readProbs[0] > 1) {
            System.err.println("The read probability must be [0, 1]: " + readProbs[0]);
            return -1;
          }
        } else if (args[i].equals("-writeProbability")) {
          if (scriptFile != null) {
            System.err.println("Can't specify probabilities and use script.");
            return -1;
          }
          writeProbs[0] = Double.parseDouble(args[++i]);
          if (writeProbs[0] < 0 || writeProbs[0] > 1) {
            System.err.println("The write probability must be [0, 1]: " + writeProbs[0]);
            return -1;
          }
        } else if (args[i].equals("-root")) {
          root = new Path(args[++i]);
        } else if (args[i].equals("-maxDelayBetweenOps")) {
          maxDelayBetweenOps = Integer.parseInt(args[++i]); // in milliseconds
        } else if (args[i].equals("-numOfThreads")) {
          numOfThreads = Integer.parseInt(args[++i]);
          if (numOfThreads <= 0) {
            System.err.println("Number of threads must be positive: " + numOfThreads);
            return -1;
          }
        } else if (args[i].equals("-startTime")) {
          startTime = Long.parseLong(args[++i]);
        } else if (args[i].equals("-elapsedTime")) {
          if (scriptFile != null) {
            System.err.println("Can't specify elapsedTime and use script.");
            return -1;
          }
          durations[0] = Long.parseLong(args[++i]);
        } else if (args[i].equals("-seed")) {
          seed = Long.parseLong(args[++i]);
          r = new Random(seed);
        } else if (args[i].equals("-flagFile")) {
          LOG.info("got flagFile:" + flagFile);
          flagFile = new Path(args[++i]);
        } else {
          System.err.println(USAGE);
          ToolRunner.printGenericCommandUsage(System.err);
          return -1;
        }
      }
    } catch (NumberFormatException e) {
      System.err.println("Illegal parameter: " + e.getLocalizedMessage());
      System.err.println(USAGE);
      return -1;
    }

    // Load Script File if not MR; for MR scriptFile is loaded by Mapper
    if (!runAsMapReduce && scriptFile != null) {
      if (loadScriptFile(scriptFile, true) == -1) return -1;
    }

    for (int i = 0; i < readProbs.length; i++) {
      if (readProbs[i] + writeProbs[i] < 0 || readProbs[i] + writeProbs[i] > 1) {
        System.err.println(
            "The sum of read probability and write probability must be [0, 1]: "
                + readProbs[i]
                + " "
                + writeProbs[i]);
        return -1;
      }
    }
    return 0;
  }
示例#16
0
 synchronized void readPhylogeniesFromWebservice() {
   final long start_time = new Date().getTime();
   URL url = null;
   Phylogeny[] trees = null;
   final WebservicesManager webservices_manager = WebservicesManager.getInstance();
   final PhylogeniesWebserviceClient client =
       webservices_manager.getAvailablePhylogeniesWebserviceClient(_webservice_client_index);
   String identifier =
       JOptionPane.showInputDialog(
           _main_frame,
           client.getInstructions() + "\n(Reference: " + client.getReference() + ")",
           client.getDescription(),
           JOptionPane.QUESTION_MESSAGE);
   if ((identifier != null) && (identifier.trim().length() > 0)) {
     identifier = identifier.trim();
     if (client.isQueryInteger()) {
       int id = -1;
       try {
         id = Integer.parseInt(identifier);
       } catch (final NumberFormatException e) {
         id = -1;
       }
       if (id < 1) {
         JOptionPane.showMessageDialog(
             _main_frame,
             "Identifier is expected to be a number",
             "Can not open URL",
             JOptionPane.ERROR_MESSAGE);
         return;
       }
       identifier = id + "";
     }
     try {
       String url_str = client.getUrl();
       url_str = url_str.replaceFirst(PhylogeniesWebserviceClient.QUERY_PLACEHOLDER, identifier);
       url = new URL(url_str);
       PhylogenyParser parser = null;
       switch (client.getReturnFormat()) {
         case TOL_XML_RESPONSE:
           parser = new TolParser();
           break;
         case NEXUS:
           parser = new NexusPhylogeniesParser();
           ((NexusPhylogeniesParser) parser).setReplaceUnderscores(true);
           break;
         case NH:
           parser = new NHXParser();
           ((NHXParser) parser).setTaxonomyExtraction(TAXONOMY_EXTRACTION.NO);
           ((NHXParser) parser).setReplaceUnderscores(true);
           ((NHXParser) parser).setGuessRootedness(true);
           break;
         case NH_EXTRACT_TAXONOMY:
           parser = new NHXParser();
           ((NHXParser) parser).setTaxonomyExtraction(TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY);
           ((NHXParser) parser).setReplaceUnderscores(false);
           ((NHXParser) parser).setGuessRootedness(true);
           break;
         case PFAM:
           parser = new NHXParser();
           ((NHXParser) parser).setTaxonomyExtraction(TAXONOMY_EXTRACTION.PFAM_STYLE_ONLY);
           ((NHXParser) parser).setReplaceUnderscores(false);
           ((NHXParser) parser).setGuessRootedness(true);
           break;
         case NHX:
           parser = new NHXParser();
           ((NHXParser) parser).setTaxonomyExtraction(TAXONOMY_EXTRACTION.NO);
           ((NHXParser) parser).setReplaceUnderscores(false);
           ((NHXParser) parser).setGuessRootedness(true);
           break;
         case PHYLOXML:
           parser = new PhyloXmlParser();
           break;
         default:
           throw new IllegalArgumentException("unknown format: " + client.getReturnFormat());
       }
       if (_main_frame.getMainPanel().getCurrentTreePanel() != null) {
         _main_frame.getMainPanel().getCurrentTreePanel().setWaitCursor();
       } else {
         _main_frame.getMainPanel().setWaitCursor();
       }
       final PhylogenyFactory factory = ParserBasedPhylogenyFactory.getInstance();
       trees = factory.create(url.openStream(), parser);
     } catch (final MalformedURLException e) {
       JOptionPane.showMessageDialog(
           _main_frame,
           "Malformed URL: " + url + "\n" + e.getLocalizedMessage(),
           "Malformed URL",
           JOptionPane.ERROR_MESSAGE);
     } catch (final IOException e) {
       JOptionPane.showMessageDialog(
           _main_frame,
           "Could not read from " + url + "\n" + e.getLocalizedMessage(),
           "Failed to read tree from " + client.getName() + " for " + identifier,
           JOptionPane.ERROR_MESSAGE);
     } catch (final NumberFormatException e) {
       JOptionPane.showMessageDialog(
           _main_frame,
           "Could not read from " + url + "\n" + e.getLocalizedMessage(),
           "Failed to read tree from " + client.getName() + " for " + identifier,
           JOptionPane.ERROR_MESSAGE);
     } catch (final Exception e) {
       e.printStackTrace();
       JOptionPane.showMessageDialog(
           _main_frame,
           e.getLocalizedMessage(),
           "Unexpected Exception",
           JOptionPane.ERROR_MESSAGE);
     } finally {
       if (_main_frame.getCurrentTreePanel() != null) {
         _main_frame.getCurrentTreePanel().setArrowCursor();
       } else {
         _main_frame.getMainPanel().setArrowCursor();
       }
     }
     if ((trees != null) && (trees.length > 0)) {
       for (final Phylogeny phylogeny : trees) {
         if (client.getName().equals(WebserviceUtil.TREE_FAM_NAME)) {
           phylogeny.setRerootable(false);
         }
         if (client.getName().equals(WebserviceUtil.PFAM_NAME)) {
           phylogeny.setRerootable(false);
           ForesterUtil.transferInternalNodeNamesToConfidence(phylogeny);
         }
         if (client.getProcessingInstructions() != null) {
           WebserviceUtil.processInstructions(client, phylogeny);
         }
         if (client.getNodeField() != null) {
           ForesterUtil.transferNodeNameToField(phylogeny, client.getNodeField());
         }
         phylogeny.setIdentifier(new Identifier(identifier, client.getName()));
         _main_frame.getJMenuBar().remove(_main_frame.getHelpMenu());
         _main_frame.getMenuBarOfMainFrame().add(_main_frame.getHelpMenu());
         _main_frame
             .getMainPanel()
             .addPhylogenyInNewTab(
                 phylogeny,
                 _main_frame.getConfiguration(),
                 new File(url.getFile()).getName(),
                 url.toString());
         String my_name_for_file = "";
         if (!ForesterUtil.isEmpty(phylogeny.getName())) {
           my_name_for_file = new String(phylogeny.getName()).replaceAll(" ", "_");
         } else if (phylogeny.getIdentifier() != null) {
           final StringBuffer sb = new StringBuffer();
           if (!ForesterUtil.isEmpty(phylogeny.getIdentifier().getProvider())) {
             sb.append(phylogeny.getIdentifier().getProvider());
             sb.append("_");
           }
           sb.append(phylogeny.getIdentifier().getValue());
           my_name_for_file = new String(sb.toString().replaceAll(" ", "_"));
         }
         _main_frame.getMainPanel().getCurrentTreePanel().setTreeFile(new File(my_name_for_file));
         Util.lookAtSomeTreePropertiesForAptxControlSettings(
             phylogeny,
             _main_frame.getMainPanel().getControlPanel(),
             _main_frame.getConfiguration());
         _main_frame.getMainPanel().getControlPanel().showWhole();
       }
     }
     _main_frame.getContentPane().repaint();
     if (((trees != null) && (trees.length > 0))
         && ((new Date().getTime() - start_time) > 20000)) {
       try {
         JOptionPane.showMessageDialog(
             null,
             ForesterUtil.wordWrap(
                 "Successfully read in "
                     + trees.length
                     + " evolutionry tree(s) from ["
                     + url
                     + "]",
                 80),
             "Success",
             JOptionPane.INFORMATION_MESSAGE);
       } catch (final Exception e) {
         // Not important if this fails, do nothing.
       }
       _main_frame.getContentPane().repaint();
     }
   }
   _main_frame.activateSaveAllIfNeeded();
   System.gc();
 }
  /**
   * Populates attributes before redirecting to a jsp.
   *
   * @param request The HttpServletRequest object
   * @param response The HttpServletReponse object
   * @throws ServletException
   * @throws IOException
   */
  @Override
  protected void doGet(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {
    request.setAttribute("fatalError", "");
    TachyonFS tachyonClient = TachyonFS.get(mTachyonConf);

    String filePath = request.getParameter("path");
    if (!(filePath == null || filePath.isEmpty())) {
      // Display file block info
      try {
        UiFileInfo uiFileInfo = getUiFileInfo(tachyonClient, new TachyonURI(filePath));
        request.setAttribute("fileBlocksOnTier", uiFileInfo.getBlocksOnTier());
        request.setAttribute("blockSizeByte", uiFileInfo.getBlockSizeBytes());
        request.setAttribute("path", filePath);

        getServletContext()
            .getRequestDispatcher("/worker/viewFileBlocks.jsp")
            .forward(request, response);
        return;
      } catch (FileDoesNotExistException fdne) {
        request.setAttribute("fatalError", "Error: Invalid Path " + fdne.getMessage());
        getServletContext()
            .getRequestDispatcher("/worker/blockInfo.jsp")
            .forward(request, response);
        return;
      } catch (IOException ie) {
        request.setAttribute(
            "invalidPathError", "Error: File " + filePath + " is not available " + ie.getMessage());
        getServletContext()
            .getRequestDispatcher("/worker/blockInfo.jsp")
            .forward(request, response);
        return;
      } catch (NotFoundException nfe) {
        request.setAttribute("fatalError", "Error: block not found. " + nfe.getMessage());
        getServletContext()
            .getRequestDispatcher("/worker/blockInfo.jsp")
            .forward(request, response);
        return;
      }
    }

    List<Integer> fileIds = getSortedFileIds();
    request.setAttribute("nTotalFile", fileIds.size());

    // URL can not determine offset and limit, let javascript in jsp determine and redirect
    if (request.getParameter("offset") == null && request.getParameter("limit") == null) {
      getServletContext().getRequestDispatcher("/worker/blockInfo.jsp").forward(request, response);
      return;
    }

    try {
      int offset = Integer.parseInt(request.getParameter("offset"));
      int limit = Integer.parseInt(request.getParameter("limit"));
      List<Integer> subFileIds = fileIds.subList(offset, offset + limit);
      List<UiFileInfo> uiFileInfos = new ArrayList<UiFileInfo>(subFileIds.size());
      for (int fileId : subFileIds) {
        uiFileInfos.add(getUiFileInfo(tachyonClient, fileId));
      }
      request.setAttribute("fileInfos", uiFileInfos);
    } catch (FileDoesNotExistException fdne) {
      request.setAttribute("fatalError", "Error: Invalid FileId " + fdne.getMessage());
      getServletContext().getRequestDispatcher("/worker/blockInfo.jsp").forward(request, response);
      return;
    } catch (NumberFormatException nfe) {
      request.setAttribute(
          "fatalError", "Error: offset or limit parse error, " + nfe.getLocalizedMessage());
      getServletContext().getRequestDispatcher("/worker/blockInfo.jsp").forward(request, response);
      return;
    } catch (IndexOutOfBoundsException iobe) {
      request.setAttribute(
          "fatalError",
          "Error: offset or offset + limit is out of bound, " + iobe.getLocalizedMessage());
      getServletContext().getRequestDispatcher("/worker/blockInfo.jsp").forward(request, response);
      return;
    } catch (IllegalArgumentException iae) {
      request.setAttribute("fatalError", iae.getLocalizedMessage());
      getServletContext().getRequestDispatcher("/worker/blockInfo.jsp").forward(request, response);
      return;
    } catch (NotFoundException nfe) {
      request.setAttribute("fatalError", nfe.getLocalizedMessage());
      getServletContext().getRequestDispatcher("/worker/blockInfo.jsp").forward(request, response);
      return;
    }

    getServletContext().getRequestDispatcher("/worker/blockInfo.jsp").forward(request, response);
  }