[PATCH] Make grain fraction type 'unknown' explicit and use it where appropriate

Wald Commits scm-commit at wald.intevation.org
Thu Jun 5 15:32:56 CEST 2014


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1401975172 -7200
# Node ID 9ec6def1a7dd36dff632b9ef0df340b4eac5e956
# Parent  c0843a658474aa2df2a6438d375bb188dba83f69
Make grain fraction type 'unknown' explicit and use it where appropriate.

diff -r c0843a658474 -r 9ec6def1a7dd backend/src/main/java/org/dive4elements/river/importer/parsers/SedimentYieldParser.java
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/SedimentYieldParser.java	Wed Jun 04 18:22:14 2014 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/SedimentYieldParser.java	Thu Jun 05 15:32:52 2014 +0200
@@ -190,7 +190,7 @@
             String newLine = line.replace(FRAKTION_START, "").trim();
             if (newLine.length() == 0) {
                 log.debug("Found total grain fraction.");
-                this.grainFraction = new ImportGrainFraction(GrainFraction.TOTAL);
+                this.grainFraction = new ImportGrainFraction(GrainFraction.UNKNOWN);
 
                 return true;
             }
@@ -372,8 +372,7 @@
         }
 
         log.warn("SYP: Unknown grain fraction: '" + gfStr + "'");
-
-        return null;
+        return new ImportGrainFraction(GrainFraction.UNKNOWN);
     }
 
 
@@ -402,7 +401,7 @@
         }
         else {
             log.warn("SYP: Unknown grain fraction '" + filename + "'");
-            return "unknown";
+            return GrainFraction.UNKNOWN;
         }
     }
 
diff -r c0843a658474 -r 9ec6def1a7dd backend/src/main/java/org/dive4elements/river/model/GrainFraction.java
--- a/backend/src/main/java/org/dive4elements/river/model/GrainFraction.java	Wed Jun 04 18:22:14 2014 +0200
+++ b/backend/src/main/java/org/dive4elements/river/model/GrainFraction.java	Thu Jun 05 15:32:52 2014 +0200
@@ -33,6 +33,7 @@
     public static final String SUSP_SAND          = "susp_sand";
     public static final String SUSP_SAND_BED      = "susp_sand_bed";
     public static final String SUSPENDED_SEDIMENT = "suspended_sediment";
+    public static final String UNKNOWN            = "unknown";
 
 
     private static Logger logger = Logger.getLogger(GrainFraction.class);


More information about the Dive4Elements-commits mailing list