X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=server%2Fcompbio%2Fcontrollers%2FIPDataController.java;h=7a7e298db281659ecbf2bc4e2261fa15ed72267a;hb=f67950b14ab016e93cca92d9b918a255728d58fd;hp=c95a6cd3be5ca602bceff998fbd391b8546803dc;hpb=c6b1558b30d0a27260e3b72ed2b87e33e2847a5f;p=proteocache.git diff --git a/server/compbio/controllers/IPDataController.java b/server/compbio/controllers/IPDataController.java index c95a6cd..7a7e298 100644 --- a/server/compbio/controllers/IPDataController.java +++ b/server/compbio/controllers/IPDataController.java @@ -31,9 +31,24 @@ public class IPDataController { } @RequestMapping(value = "/ip/stat/querycounter", method = RequestMethod.GET) - public String findIPwithCounter(@RequestParam("JobCounter") int counter, Map model) { - - if (counter < 1) { + public String findIPwithCounter(@RequestParam("JobCounter") String counter, Map model) { + + if (counter.equals("")) { + model.put("error", "The value must not be empty"); + model.put("value", counter); + return "queryIPStatistics"; + } + + int realcounter; + try { + realcounter = Integer.parseInt(counter.trim()); + } catch (NumberFormatException e) { + model.put("error", "The value must be an integer number"); + model.put("value", counter); + return "queryIPStatistics"; + } + + if (realcounter < 1) { model.put("error", "The value must be greater than 0"); model.put("value", counter); return "queryIPStatistics"; @@ -41,7 +56,7 @@ public class IPDataController { final long startTime = System.currentTimeMillis(); CassandraRequester cr = new CassandraRequester(); - List r = cr.readIpByCounter(counter); + List r = cr.readIpByCounter(realcounter); model.put("results", r); model.put("njobs", 0); if (null != r) { @@ -49,7 +64,7 @@ public class IPDataController { } final long endTime = System.currentTimeMillis(); model.put("timeExecution", (endTime - startTime)); - model.put("counter", counter); + model.put("counter", realcounter); return "reportIPstatistics"; }