[Dive4elements-commits] [PATCH] Backend: Create ImportWsts for official lines expicitly. They are going to be somewhat special. Removed some cruft from the WstParser

Wald Commits scm-commit at wald.intevation.org
Fri Jun 14 16:11:52 CEST 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1371219109 -7200
# Node ID 224d7c4b5291f6961eaf4376ce6a10c262b83ab9
# Parent  c4fbd85a33eedd9182fc9bf405444beca617d4ed
Backend: Create ImportWsts for official lines expicitly. They are going to be somewhat special. Removed some cruft from the WstParser.

diff -r c4fbd85a33ee -r 224d7c4b5291 backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java	Fri Jun 14 13:25:23 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportRiver.java	Fri Jun 14 16:11:49 2013 +0200
@@ -792,9 +792,10 @@
             }
             log.debug("Found WST file: " + file);
 
-            WstParser wstParser = new WstParser();
+            ImportWst iw = new ImportWst();
+
+            WstParser wstParser = new WstParser(iw);
             wstParser.parse(file);
-            ImportWst iw = wstParser.getWst();
             iw.setKind(3);
             iw.setDescription(folder + "/" + iw.getDescription());
 
diff -r c4fbd85a33ee -r 224d7c4b5291 backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java	Fri Jun 14 13:25:23 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java	Fri Jun 14 16:11:49 2013 +0200
@@ -69,6 +69,10 @@
     public WstParser() {
     }
 
+    public WstParser(ImportWst wst) {
+        this.wst = wst;
+    }
+
     public ImportWst getWst() {
         return wst;
     }
@@ -95,13 +99,11 @@
 
         wst = new ImportWst(file.getName());
 
-        LineNumberReader in = null;
+        LineNumberReader in =
+            new LineNumberReader(
+            new InputStreamReader(
+            new FileInputStream(file), ENCODING));
         try {
-            in =
-                new LineNumberReader(
-                new InputStreamReader(
-                new FileInputStream(file), ENCODING));
-
             String input;
             boolean first = true;
             int columnCount = 0;
@@ -109,7 +111,7 @@
             String [] lsBezeichner   = null;
             String [] langBezeichner = null;
             int    [] colNaWidths    = null;
-            String [] quellen        = null;
+            // String [] quellen        = null;
             String [] daten          = null;
 
             BigDecimal [] aktAbfluesse   = null;
@@ -213,7 +215,7 @@
                         if (spezial.length() == 0) {
                             continue;
                         }
-                        quellen = StringUtil.splitQuoted(spezial, '"');
+                        // quellen = StringUtil.splitQuoted(spezial, '"');
                     }
                     else if (spezial.startsWith(COLUMN_DATUM)) {
                         spezial = spezial.substring(COLUMN_DATUM.length()).trim();
@@ -356,9 +358,7 @@
             fixRangesOrder();
         }
         finally {
-            if (in != null) {
-                in.close();
-            }
+            in.close();
         }
     }
 


More information about the Dive4elements-commits mailing list