List of usage examples for java.lang NumberFormatException printStackTrace
public void printStackTrace()
From source file:org.accada.hal.impl.sim.multi.BatchSimulatorServer.java
/** * <p>Execute one line after the other from the batch file.</p> * Line Format: <code>SLEEPTIME; EVENT_TYPE; READER_ID; ANTENNA_ID; TAG_ID</code> * <ul><li><code>SLEEPTIME</code>: time in ms which the simulator will sleep before execute the corresponding line</li> * <li><code>EVENT_TYPE</code>: <code>EN</code> or <code>EX</code> for an enter or exit event</li> * <li><code>READER_ID</code>: the id of the reader to which the tag will be added or removed.</li> * <li><code>ANTENNA_ID</code>: the id of the antenna to which the tag will be added or removed.</li> * <li><code>TAG_ID</code>: the id of the tag which will be added or removed</li></ul> *//*from w ww . j a v a 2s . co m*/ public void run() { LOG.info("BatchSimulatorServer started"); try { int iteration = 1; while (iterations < 1 || iteration <= iterations) { LOG.info(iteration + ". iteration"); // load batch file BufferedReader batchFileReader = new BufferedReader(new FileReader(batchFile)); // read first line int lineNbr = 0; String line = batchFileReader.readLine(); // iterate until the end of the file is reached while (line != null) { lineNbr++; // parse line try { // check if the line has 5 arguments String[] fragments = line.split(";"); if (fragments.length != 5) { throw new IllegalArgumentException(); } // sleep for the sleep time (1. argument) try { long sleepTime = Long.parseLong(fragments[0].trim()); Thread.sleep(sleepTime); } catch (NumberFormatException e) { throw new SimulatorServerException( "Illegal batch file line (" + lineNbr + "). First argument must be a number."); } // get event type (2. argument) String eventType = fragments[1].trim(); // get reader id (3. argument) String readerId = fragments[2].trim(); // get antenna id (4. argument) String antennaId = fragments[3].trim(); // get tag id (5. argument) String tagId = fragments[4].trim(); // fire event if (BatchSimulatorTokens.ENTER.equals(eventType)) { LOG.info("add tag '" + tagId + "' to antenna '" + antennaId + "' of reader '" + readerId + "'"); controller.add(readerId, antennaId, tagId); } else if (BatchSimulatorTokens.EXIT.equals(eventType)) { LOG.info("remove tag '" + tagId + "' to antenna '" + antennaId + "' of reader '" + readerId + "'"); controller.remove(readerId, antennaId, tagId); } else { throw new SimulatorServerException("Illegal batch file line (" + lineNbr + "). Second argument must be '" + BatchSimulatorTokens.ENTER + "' or '" + BatchSimulatorTokens.EXIT + "'."); } } catch (SimulatorServerException e) { LOG.error("[ERROR] " + e.getMessage()); } // read next line line = batchFileReader.readLine(); } // close batch file batchFileReader.close(); iteration++; } } catch (IOException e) { e.printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); } LOG.info("end of batch-file reached."); controller.stop(); }
From source file:com.amaze.carbonfilemanager.fragments.MainFragment.java
private void addTo(BaseFile mFile) { File f = new File(mFile.getPath()); String size = ""; if (!dataUtils.getHiddenfiles().contains(mFile.getPath())) { if (mFile.isDirectory()) { size = ""; LayoutElement layoutElement = utils.newElement(folder, f.getPath(), mFile.getPermission(), mFile.getLink(), size, 0, true, false, mFile.getDate() + ""); layoutElement.setMode(mFile.getMode()); addLayoutElement(layoutElement); folder_count++;/* www .jav a 2s . c om*/ } else { long longSize = 0; try { if (mFile.getSize() != -1) { longSize = mFile.getSize(); size = Formatter.formatFileSize(getContext(), longSize); } else { size = ""; longSize = 0; } } catch (NumberFormatException e) { //e.printStackTrace(); } try { LayoutElement layoutElement = utils.newElement(Icons.loadMimeIcon(f.getPath(), !IS_LIST, res), f.getPath(), mFile.getPermission(), mFile.getLink(), size, longSize, false, false, mFile.getDate() + ""); layoutElement.setMode(mFile.getMode()); addLayoutElement(layoutElement); file_count++; } catch (Exception e) { e.printStackTrace(); } } } }
From source file:com.craftcosta.jailrules.rpgcraftcosta.GUI.java
private void draw_graph_btnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_draw_graph_btnActionPerformed int level;/* w w w . j a va2 s.c o m*/ boolean error; try { graph_panel.removeAll(); if (max_level.getText().equals("")) { this.max_level.setBackground(Color.red); throw new Exception("Rellena el campo nivel mximo"); } else { level = Integer.parseInt(max_level.getText()); if (level <= 0) { this.max_level.setBackground(Color.red); throw new Exception("Selecciona un nivel mayor que 0 para continuar"); } else { this.max_level.setBackground(Color.white); //dibujar grafico XYDataset dataset = createDataset(level); JFreeChart chart = ChartFactory.createXYLineChart("Level Progression", "level", "experience needed", dataset); ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new Dimension(800, 500)); chartPanel.setMouseWheelEnabled(true); graph_panel.setLayout(new java.awt.BorderLayout()); graph_panel.add(chartPanel, BorderLayout.CENTER); graph_panel.validate(); graph_panel.repaint(); } } } catch (NumberFormatException e) { JOptionPane.showMessageDialog(rootPane, e.getMessage(), "Error en nivel maximo", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } catch (Exception e) { JOptionPane.showMessageDialog(rootPane, e.getMessage(), "Error en nivel maximo", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } }
From source file:com.chcit.scm.web.ent.action.BPartnerActionController.java
public void saveAndEdit(HttpServletRequest req, HttpServletResponse resp) throws JsonResultException { try {//from w w w .j a v a2 s .c o m String id = req.getParameter("id"); // ????? String BPartnerCode = req.getParameter("BPartnerCode"); MBPartner bp = null; if (StringUtils.isNotEmpty(id)) bp = MBPartner.get(Integer.valueOf(id)); if (bp == null) { bp = new MBPartner(); bp.setIsActive(true); bp.setSource_Server_ID(LinkUtil.getSelfServerID()); bp.setAD_Server_ID(getAD_Server_ID()); if (bp.getAD_Server_ID() == 0) throw new Exception("?"); MServer srv = MServer.get(bp.getAD_Server_ID()); if (srv == null) throw new Exception("" + bp.getAD_Server_ID() + ""); bp.setClientOrg(srv); } // else { // if (bp.getAD_OrgBP_ID() != ctx.getAD_Org_ID()) // throw new Exception("??"); // } // String AD_Server_ID = req.getParameter("AD_Server_ID"); // int serverId; // try { // serverId = Integer.valueOf(AD_Server_ID); // } catch (Exception e) { // throw new Exception("?"); // } boolean exists = false; String sql = "SELECT EAI_BPartner_ID FROM eai_bpartner where AD_Server_ID=? and BPartnerCode=?"; DataResultSet rs = DB.executeQuery(sql, bp.getAD_Server_ID(), BPartnerCode); if (StringUtils.isEmpty(id)) { if (rs.count() > 0) exists = true; } else { if (rs.count() == 0 || (rs.count() == 1 && rs.getInt(1) == Integer.valueOf(id))) exists = false; else { exists = true; } } if (exists) throw new Exception("???"); bp.setBPartnerCode(BPartnerCode); bp.setName(req.getParameter("Name")); bp.setValue(req.getParameter("Value")); bp.setAddress(req.getParameter("Address")); bp.setPhone(req.getParameter("Phone")); bp.setLegalPerson(req.getParameter("LegalPerson")); String CorpFund = req.getParameter("CorpFund"); if (CorpFund != null && CorpFund.trim().length() > 0) try { bp.setCorpFund(new BigDecimal(CorpFund.trim())); } catch (NumberFormatException e) { throw new Exception("?"); } else bp.setCorpFund(Env.ZERO); // System.out.println("req.getParameter('CustomerLevel')="+req. // getParameter("CustomerLevel")); String customerLevel = req.getParameter("CustomerLevel"); if (StringUtils.isNotEmpty(customerLevel)) bp.setCustomerLevel(customerLevel); bp.setBusinessScope(req.getParameter("BusinessScope")); bp.setContact(req.getParameter("Contact")); bp.setContactPhone(req.getParameter("ContactPhone")); bp.setContactIDNo(req.getParameter("ContactIDNo")); bp.setContact2(req.getParameter("Contact2")); bp.setContactPhone2(req.getParameter("ContactPhone2")); bp.setContactIDNo2(req.getParameter("ContactIDNo2")); bp.setDescription(req.getParameter("Description")); // System.out.println("req.getParameter('IsCustomer')="+req. // getParameter("IsCustomer")); //System.out.println("req.getParameter('IsVendor')="+req.getParameter // ("IsVendor")); bp.setIsCustomer("on".equalsIgnoreCase(req.getParameter("IsCustomer"))); bp.setIsVendor("on".equalsIgnoreCase(req.getParameter("IsVendor"))); bp.save(); } catch (Exception e) { e.printStackTrace(); throw new JsonResultException(e); } ProcessResult<JSON> pr = new ProcessResult<JSON>(true); sendJSON(resp, pr.toJSON()); }
From source file:com.androzic.Androzic.java
public void moveTileCache() { File oldTilesCache = new File(rootPath, "tiles"); if (!oldTilesCache.isDirectory()) return;//w w w.j a v a2 s.c o m File newCache = getCacheDir(); Pattern p = Pattern.compile("(\\d+)-(\\d+)"); Matcher m; for (File providerDir : oldTilesCache.listFiles()) { if (!providerDir.isDirectory()) { providerDir.delete(); continue; } String provider = providerDir.getName(); for (File zoom : providerDir.listFiles()) { if (!zoom.isDirectory()) { zoom.delete(); continue; } byte z; try { z = Byte.valueOf(zoom.getName()); } catch (NumberFormatException e) { e.printStackTrace(); zoom.delete(); continue; } for (File tile : zoom.listFiles()) { m = p.matcher(tile.getName()); if (m.find()) { int x = Integer.parseInt(m.group(1)); int y = Integer.parseInt(m.group(2)); File newTile = TileFactory.getTileFile(newCache, provider, x, y, z); try { FileUtils.copyFile(tile, newTile); } catch (IOException e) { e.printStackTrace(); } } tile.delete(); } zoom.delete(); } providerDir.delete(); } oldTilesCache.delete(); }
From source file:de.uniwue.info6.database.jdbc.ConnectionManager.java
/** * * * @param scenario//from ww w. ja v a2s . c o m * @return * @throws SQLException */ public synchronized String addScenarioDatabase(Scenario scenario) throws SQLException { if (scenario != null) { String dbHost = "", dbUser = "", dbPass = "", dbPort = "", url = "", dbName = ""; Connection connection = null; ResultSet resultSet = null; try { if (newAdminDataSource == null) { createAdminDataSource(); } if (newAdminDataSource != null) { connection = newAdminDataSource.getConnection(); resultSet = connection.getMetaData().getCatalogs(); dbName = Cfg.SLAVE_DB_PREFIX + StringTools.zeroPad(1, 3); ArrayList<String> dbNames = new ArrayList<String>(); while (resultSet.next()) { dbNames.add(resultSet.getString(1).toLowerCase().trim()); } int count = 1; while (dbNames.contains(dbName)) { try { count = Integer.parseInt(dbName.substring(dbName.length() - 3, dbName.length())); dbName = dbName.substring(0, dbName.length() - 3) + StringTools.zeroPad(++count, 3); } catch (NumberFormatException e) { dbName = dbName + "_" + new Random().nextInt(10000); } } DatabaseTools.createDatabase(connection, dbName); return dbName; } else { throw new SQLException(); } } catch (Exception e) { throw new SQLException("could not connect to admin database: " + "[" + dbHost + "]" + "[" + dbUser + "]" + "[" + dbPass + "]" + "[" + dbPort + "]" + "[" + url + "]", e); } finally { try { if (resultSet != null) { resultSet.close(); } if (connection != null) { connection.close(); } } catch (SQLException e) { e.printStackTrace(); } } } return null; }
From source file:edu.ksu.cs.a4vm.bse.MatingInfo.java
@Override public void onResume() { super.onResume(); //load data/* w w w.j a v a 2s . c om*/ Util.setFields(SharedPrefUtil.getValue(getApplicationContext(), Constant.PREFS_MATING_INFO, bullKey), fields); //display toggle buttons Util.setToggleButtons(SharedPrefUtil.getValue(getApplicationContext(), Constant.PREFS_MATING_INFO, bullKey), tgBtns); save.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //Toast.makeText(getApplicationContext(),tgbtn.getText().toString().trim() + bullKey,Toast.LENGTH_SHORT).show(); if (tgbtn.getCurrentTextColor() == ContextCompat.getColor(getApplicationContext(), R.color.colorAccent) || tgbtn1.getCurrentTextColor() == ContextCompat.getColor(getApplicationContext(), R.color.colorAccent) || tgbtn2.getCurrentTextColor() == ContextCompat.getColor(getApplicationContext(), R.color.colorAccent) || tgbtn3.getCurrentTextColor() == ContextCompat.getColor(getApplicationContext(), R.color.colorAccent)) { try { if (breedSeason.getText().toString().trim().length() == 0 || (Integer.parseInt(breedSeason.getText().toString().trim()) > 0 && Integer.parseInt(breedSeason.getText().toString().trim()) < 31)) { LinkedHashSet<String> data = new LinkedHashSet<String>(); data.add(tgbtn.getText().toString().trim() + "=" + tgbtn.getCurrentTextColor()); data.add(tgbtn1.getText().toString().trim() + "=" + tgbtn1.getCurrentTextColor()); data.add(tgbtn2.getText().toString().trim() + "=" + tgbtn2.getCurrentTextColor()); data.add(tgbtn3.getText().toString().trim() + "=" + tgbtn3.getCurrentTextColor()); data.add(breedSeason.getHint().toString().trim() + "=" + breedSeason.getText().toString().trim()); data.add(perfDesc.getHint().toString().trim() + "=" + perfDesc.getText().toString().trim().replace(",", ";")); data.add(comments.getHint().toString().trim() + "=" + comments.getText().toString().trim().replace(",", ";")); data.add(sire1Btn.getText().toString().trim() + "=" + sire1Btn.getCurrentTextColor()); data.add(sire2Btn.getText().toString().trim() + "=" + sire2Btn.getCurrentTextColor()); data.add(sire3Btn.getText().toString().trim() + "=" + sire3Btn.getCurrentTextColor()); //save to shared pref SharedPrefUtil.saveGroup(getApplicationContext(), Constant.PREFS_MATING_INFO, bullKey, data); Intent goPrev = new Intent(getApplicationContext(), BullExam.class); goPrev.putExtra("bullKey", bullKey); startActivity(goPrev); Toast.makeText(getApplicationContext(), "Saved!", Toast.LENGTH_SHORT).show(); } else { Toast.makeText(getApplicationContext(), "Breed Season should be 1-30", Toast.LENGTH_LONG).show(); breedSeason.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.highlight)); } } catch (NumberFormatException ne) { if (breedSeason.getText().toString().trim().length() > 0) { Toast.makeText(getApplicationContext(), "Breed Season should be 1-30", Toast.LENGTH_SHORT).show(); breedSeason.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.highlight)); } else { breedSeason.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.no_fill)); } } catch (Exception e) { Toast.makeText(getApplicationContext(), "Invalid information entered", Toast.LENGTH_SHORT) .show(); } } else { Toast.makeText(getApplicationContext(), "Performance last season must be specified", Toast.LENGTH_LONG).show(); } } }); breedSeason.setOnFocusChangeListener(new View.OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { if (!hasFocus) { String text = breedSeason.getText().toString().trim(); try { if (Integer.valueOf(text) > 0 && Integer.valueOf(text) < 31) { breedSeason.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.focus_color)); } else { breedSeason.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.highlight)); Toast.makeText(getApplicationContext(), "Breed Season should be 1-30", Toast.LENGTH_SHORT).show(); } } catch (NumberFormatException ne) { if (text.length() > 0) { ne.printStackTrace(); breedSeason.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.highlight)); Toast.makeText(getApplicationContext(), "Invalid breed season", Toast.LENGTH_SHORT) .show(); } else { breedSeason.setBackground( ContextCompat.getDrawable(getApplicationContext(), R.drawable.no_fill)); } } } } }); }
From source file:eu.prestoprime.plugin.mserve.MServeTasks.java
@WfService(name = "mserve_ffprobe", version = "1.1.0") public void ffprobe(Map<String, String> sParams, Map<String, String> dParamsString, Map<String, File> dParamFile) throws TaskExecutionFailedException { // get static parameters String url = sParams.get("mserve.url"); // get dynamic parameters String sipID = dParamsString.get("sipID"); String fileID = dParamsString.get("mserveFileID"); String userID = dParamsString.get("userID"); // get serviceID String serviceID = ConfigurationManager.getUserInstance().getService(userID, "mserve"); SIP sip = null;/*from w w w.j av a 2 s . c o m*/ try { // get sip sip = P4DataManager.getInstance().getSIPByID(sipID); // run FFprobe MServeClient cl = new MServeClient(url, serviceID); Map<String, String> params = new HashMap<>(); params.put("format", "json"); File output = cl.runMServeTask(fileID, MServeTask.ffprobe, params); logger.debug("Completed FFProbe Task on MServe for fileID: " + fileID); BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(output))); String line; StringBuffer sb = new StringBuffer(); while ((line = reader.readLine()) != null) { sb.append(line); } logger.debug("Appended output FFProbe..."); // get JSON Object JSONObject json = new JSONObject(sb.toString()); logger.debug("Parsed JSONObject response..."); Section section = new Section(); section.setId("ffprobe"); // FFprobe show format JSONObject jsonFormat = json.getJSONObject("format"); logger.debug("Parsed JSONObject Format..."); Iterator<String> itFormat = jsonFormat.keys(); while (itFormat.hasNext()) { String key = itFormat.next(); logger.debug("key: " + key); String value = jsonFormat.getString(key); logger.debug(" value: " + value); Record record = new Record(); Key keyType = new Key(); keyType.setId("significantPropertiesType"); keyType.setValue("ffprobe:" + key); record.getKey().add(keyType); Key keyValue = new Key(); keyValue.setId("significantPropertiesValue"); keyValue.setValue(value); record.getKey().add(keyValue); section.getRecord().add(record); } // set format String formatN = jsonFormat.getString("format_name"); String formatLN = jsonFormat.getString("format_long_name"); // size String size = jsonFormat.getString("size"); dParamsString.put("isMXF", "false"); if (formatN != null) { synchronized (sip) { List<String> formats = sip.getDCField(DCField.format); formats.add(formatLN + "(" + formatN.toUpperCase() + ")"); sip.setDCField(DCField.format, formats); } if (formatN.equalsIgnoreCase("MXF")) { dParamsString.put("isMXF", "true"); } } // FFprobe show streams JSONArray jsonStreams = json.getJSONArray("streams"); String secDuration = null; String frameRate = null; int numOfStreams = jsonStreams.length(); for (int i = 0; i < jsonStreams.length(); i++) { JSONObject jsonStream = jsonStreams.getJSONObject(i); String index = jsonStream.getString("index"); logger.debug("Parsing index " + index); Iterator<String> itStream = jsonStream.keys(); while (itStream.hasNext()) { String key = itStream.next(); String value = jsonStream.getString(key); Record record = new Record(); Key keyType = new Key(); keyType.setId("significantPropertiesType"); keyType.setValue("ffprobe:" + key + "_" + index); record.getKey().add(keyType); Key keyValue = new Key(); keyValue.setId("significantPropertiesValue"); keyValue.setValue(value); record.getKey().add(keyValue); section.getRecord().add(record); } if (jsonStream.getString("codec_type").equals("video")) { secDuration = jsonStream.getString("duration"); frameRate = jsonStream.getString("r_frame_rate"); } } try { dParamsString.put("duration", "" + (int) Double.parseDouble(secDuration)); } catch (NumberFormatException e) { dParamsString.put("duration", "0"); } if (frameRate != null) { String fpsString = frameRate.split("/")[0]; try { dParamsString.put("fps", "" + Integer.parseInt(fpsString)); } catch (NumberFormatException e) { dParamsString.put("fps", "25"); } } // set new DNX section Dnx dnx = new Dnx(); dnx.getSection().add(section); sip.addDNX(dnx, "ffprobe", true); // add DNX section with video information Record videoRecord = new Record(); Key key1 = new Key(); key1.setId("duration"); key1.setValue(secDuration); videoRecord.getKey().add(key1); Key key2 = new Key(); key2.setId("nb_streams"); key2.setValue(String.valueOf(numOfStreams)); videoRecord.getKey().add(key2); Key key3 = new Key(); key3.setId("format_long_name"); key3.setValue(formatLN); videoRecord.getKey().add(key3); Key key4 = new Key(); key4.setId("size"); key4.setValue(size); videoRecord.getKey().add(key4); Section videoSec = new Section(); videoSec.setId("videoMD"); videoSec.getRecord().add(videoRecord); Dnx videoDnx = new Dnx(); videoDnx.getSection().add(videoSec); sip.addDNX(videoDnx, "videoMD", false); } catch (DataException e) { e.printStackTrace(); throw new TaskExecutionFailedException("Unable to find SIP..."); } catch (IPException e) { e.printStackTrace(); throw new TaskExecutionFailedException("Unable to work with SIP..."); } catch (MServeException | IOException e) { e.printStackTrace(); throw new TaskExecutionFailedException("Unable to run FFProbe extractor on MServe..."); } catch (JSONException e) { e.printStackTrace(); throw new TaskExecutionFailedException("Unable to parse JSON from MServe..."); } finally { // release SIP P4DataManager.getInstance().releaseIP(sip); } }
From source file:com.znsx.cms.web.controller.DeviceController.java
@InterfaceDescription(logon = true, method = "List_Manufacturer", cmd = "2040") @RequestMapping("/list_manufacturer.json") public void listManufacturer(HttpServletRequest request, HttpServletResponse response) throws Exception { Integer startIndex = 0;/*w ww . j a va 2 s . co m*/ String startIndexString = request.getParameter("startIndex"); if (StringUtils.isNotBlank(startIndexString)) { try { startIndex = Integer.parseInt(startIndexString); } catch (NumberFormatException be) { be.printStackTrace(); throw new BusinessException(ErrorCode.PARAMETER_INVALID, "Parameter startIndex[" + startIndexString + "] invalid !"); } } Integer limit = 1000; String limitString = request.getParameter("limit"); if (StringUtils.isNotBlank(limitString)) { try { limit = Integer.parseInt(limitString); } catch (NumberFormatException be) { be.printStackTrace(); throw new BusinessException(ErrorCode.PARAMETER_INVALID, "Parameter limit[" + limitString + "] invalid !"); } } List<Manufacturer> manufacturers = deviceManager.listManufacturer(startIndex, limit); Integer totalCount = deviceManager.manufacturerTotalCount(); ListManufacturerDTO dto = new ListManufacturerDTO(); dto.setCmd("2040"); dto.setMethod("List_Manufacturer"); dto.setListManufacturer(manufacturers); dto.setTotalCount(totalCount); writePage(response, dto); }
From source file:com.znsx.cms.web.controller.DeviceController.java
@InterfaceDescription(logon = true, method = "List_Dvr_By_Device", cmd = "2055") @RequestMapping("/list_dvr_by_device.json") public void listDvrByDevice(HttpServletRequest request, HttpServletResponse response) throws Exception { String name = request.getParameter("name"); name = StringUtils.replace(name, " ", "+"); String standardNumber = request.getParameter("standardNumber"); String organId = request.getParameter("organId"); if (StringUtils.isBlank(organId)) { throw new BusinessException(ErrorCode.PARAMETER_NOT_FOUND, "missing [organId]"); }//from www. j av a2 s .c o m String ip = request.getParameter("ip"); Integer startIndex = 0; String start = request.getParameter("startIndex"); if (StringUtils.isNotBlank(start)) { try { startIndex = Integer.parseInt(start); } catch (NumberFormatException n) { n.printStackTrace(); throw new BusinessException(ErrorCode.PARAMETER_INVALID, "Parameter startIndex[" + start + "] invalid !"); } } Integer limit = 1000; String limitString = request.getParameter("limit"); if (StringUtils.isNotBlank(limitString)) { try { limit = Integer.parseInt(limitString); } catch (NumberFormatException n) { n.printStackTrace(); throw new BusinessException(ErrorCode.PARAMETER_INVALID, "Parameter limit[" + limitString + "] invalid !"); } } String logonUserId = resource.get().getId(); ListDvrDTO dto = deviceManager.listDvrByDevice(name, standardNumber, ip, startIndex, limit, logonUserId, organId); dto.setCmd("2055"); dto.setMethod("List_Dvr_By_Device"); writePage(response, dto); }