comparison artifacts/src/main/java/org/dive4elements/river/utils/RiverUtils.java @ 8351:0d3d018fc632

Never ever set current km via RiverUtils.
author Tom Gottfried <tom@intevation.de>
date Wed, 01 Oct 2014 13:40:30 +0200
parents e4606eae8ea5
children b37cd2db9659
comparison
equal deleted inserted replaced
8350:427a813b1791 8351:0d3d018fc632
888 else if (q < 1000d) q = Math.rint((q*10d)) / 10d; 888 else if (q < 1000d) q = Math.rint((q*10d)) / 10d;
889 else if (q >= 1000d) q = Math.rint(q); 889 else if (q >= 1000d) q = Math.rint(q);
890 return q; 890 return q;
891 } 891 }
892 892
893 /** Parses the request and checks if it contains a currentKM setting.
894 * If this is the case the currentKM is added to the context.*/
895 public static void setKMFromRequestInContext(Document request,
896 CallContext context) {
897 Double dKm;
898 String km = XMLUtils.xpathString(
899 request,
900 XPATH_CHART_CURRENTKM,
901 ArtifactNamespaceContext.INSTANCE);
902
903 if (km == null) {
904 return;
905 }
906
907 try {
908 dKm = Double.valueOf(km);
909 } catch (NumberFormatException nfe) {
910 return;
911 }
912
913 if (log.isDebugEnabled()) {
914 log.debug("currentKm = " + dKm);
915 }
916 context.putContextValue(CURRENT_KM, dKm);
917 }
918 } 893 }
919 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 894 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org