comparison src/main/java/de/intevation/lada/rest/ProbeService.java @ 1068:8d1df8f31475

Avoid ISE if invalid datetime values are provided.
author Tom Gottfried <tom@intevation.de>
date Fri, 30 Sep 2016 11:15:32 +0200
parents 0a44ab47d3d5
children 703b370c3b34
comparison
equal deleted inserted replaced
1067:0a44ab47d3d5 1068:8d1df8f31475
365 @Context HttpHeaders headers, 365 @Context HttpHeaders headers,
366 @Context HttpServletRequest request, 366 @Context HttpServletRequest request,
367 JsonObject object 367 JsonObject object
368 ) { 368 ) {
369 String id = object.get("id").toString(); 369 String id = object.get("id").toString();
370 long start = object.getJsonNumber("start").longValue(); 370 long start = 0;
371 long end = object.getJsonNumber("end").longValue(); 371 long end = 0;
372 try {
373 start = object.getJsonNumber("start").longValue();
374 end = object.getJsonNumber("end").longValue();
375 } catch (ClassCastException e) {
376 // Catch invalid (i.e. too high) time values
377 return new Response(false, 612, null);
378 }
372 if (start > end) { 379 if (start > end) {
373 return new Response(false, 662, null); 380 return new Response(false, 662, null);
374 } 381 }
375 List<LProbe> proben = factory.create( 382 List<LProbe> proben = factory.create(
376 id, 383 id,
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)