[PATCH 2 of 2] issue1433: Include trailing empty strings in stringsplit, this prevents emission

Wald Commits scm-commit at wald.intevation.org
Tue Aug 6 10:56:56 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1375779985 -7200
# Node ID e032e9e6d09e9dfcac92b1b0ae1f649ac137b4f9
# Parent  f275aae00c55ccc0873dc6fe9c6eaf3a6256727a
issue1433: Include trailing empty strings in stringsplit, this prevents emission
of false warnings.

diff -r f275aae00c55 -r e032e9e6d09e backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelDifferencesParser.java
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelDifferencesParser.java	Tue Aug 06 10:54:41 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/WaterlevelDifferencesParser.java	Tue Aug 06 11:06:25 2013 +0200
@@ -203,7 +203,8 @@
      * @param line the line to parse
      */
     private void handleDataLine(String line) {
-        String[] cols = line.split(SEPERATOR_CHAR);
+        // Split by separator, do not exclude trailing empty string.
+        String[] cols = line.split(SEPERATOR_CHAR, -1);
 
         if (cols == null || cols.length < 2) {
             log.warn("skip invalid waterlevel-diff line: '" + line + "'");


More information about the Dive4elements-commits mailing list