[Dive4elements-commits] [PATCH 2 of 2] WstParser: set column names from specified line also if unspecified line does not exist

Wald Commits scm-commit at wald.intevation.org
Thu May 16 12:34:36 CEST 2013


# HG changeset patch
# User Tom Gottfried <tom.gottfried at intevation.de>
# Date 1368700463 -7200
# Node ID f9c5e1a8032d551e0f9b5a4c787e0307930c9987
# Parent  25d927cb4b259154123863d51226fc124229f88f
WstParser: set column names from specified line also if unspecified line does not exist

diff -r 25d927cb4b25 -r f9c5e1a8032d backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java	Thu May 16 12:31:53 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java	Thu May 16 12:34:23 2013 +0200
@@ -248,9 +248,15 @@
                         int unknownCount = 0;
                         HashSet<String> uniqueColumnNames =
                             new HashSet<String>();
+                        if (langBezeichner != null) {
+                            // use column name from '*!column-bez-text'-line
+                            lsBezeichner = StringUtil.fitArray(
+                                langBezeichner, lsBezeichner);
+                        }
                         for (int i = 0; i < lsBezeichner.length; ++i) {
                             if (lsBezeichner[i] == null
                             || lsBezeichner[i].length() == 0) {
+                                // generate alternative column names
                                 double q = firstAbfluesse[i].doubleValue();
                                 if (q < 0.001) {
                                     lsBezeichner[i] =
@@ -309,8 +315,7 @@
                 }
                 else { // firstAbfluesse == null
                     if (langBezeichner != null) {
-                        lsBezeichner = StringUtil.fitArray(
-                            langBezeichner, lsBezeichner);
+                        // nothing to do
                     }
                     else if (colNaWidths != null) {
                         for (int j = 0, i = 0, N = input.length();


More information about the Dive4elements-commits mailing list