changeset 6029:f9c5e1a8032d

WstParser: set column names from specified line also if unspecified line does not exist
author Tom Gottfried <tom.gottfried@intevation.de>
date Thu, 16 May 2013 12:34:23 +0200
parents 25d927cb4b25
children d12f920bbf00
files backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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();

http://dive4elements.wald.intevation.org