[PATCH] Temporarily: log sinfo meanbedheight formatting

Wald Commits scm-commit at wald.intevation.org
Wed Sep 19 17:54:10 CEST 2018


# HG changeset patch
# User mschaefer
# Date 1537372433 -7200
# Node ID d7d22ea8573dfc046d4b0eb5329149b83176eee5
# Parent  e44c1a8b0c5428af5e672efe33fe20abfa38e5d1
Temporarily: log sinfo meanbedheight formatting

diff -r e44c1a8b0c54 -r d7d22ea8573d artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractResultType.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractResultType.java	Wed Sep 19 16:21:08 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractResultType.java	Wed Sep 19 17:53:53 2018 +0200
@@ -98,7 +98,7 @@
         return formatter.format(value);
     }
 
-    private NumberFormat getFormatter(final CallContext context) {
+    protected NumberFormat getFormatter(final CallContext context) {
         final CallMeta meta = context.getMeta();
         final Locale locale = Resources.getLocale(meta);
 
diff -r e44c1a8b0c54 -r d7d22ea8573d artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultType.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultType.java	Wed Sep 19 16:21:08 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/common/SInfoResultType.java	Wed Sep 19 17:53:53 2018 +0200
@@ -212,8 +212,15 @@
         @Override
         public String exportValue(final CallContext context, final Object value) {
             final double doubleValue = asDouble(value);
-            log.trace(String.format("meanBedHeight.exportValue value: %f doubleValue: %f formatted to: %s", value, doubleValue,
-                    exportDoubleValue(context, doubleValue)));
+            String rm;
+            try {
+                rm = getFormatter(context).getRoundingMode().toString();
+            }
+            catch (final Exception e) {
+                rm = "?";
+            }
+            log.trace(String.format("meanBedHeight.exportValue roundingmode: %s value: %f doubleValue: %f formatted to: %s",
+                    rm, value, doubleValue, exportDoubleValue(context, doubleValue)));
             return exportDoubleValue(context, doubleValue);
         }
 


More information about the Dive4Elements-commits mailing list