changeset 1477:6e694603cde1

Improved the CSVExportService to ignore lines that begin with a '#' character. flys-client/trunk@3522 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 22 Dec 2011 09:28:22 +0000
parents edf18a9dfd8b
children 237e7450ae2e
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/server/CSVExportServiceImpl.java
diffstat 2 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Thu Dec 22 09:23:42 2011 +0000
+++ b/flys-client/ChangeLog	Thu Dec 22 09:28:22 2011 +0000
@@ -1,3 +1,9 @@
+2011-12-22  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/CSVExportServiceImpl.java:
+	  This service now skips lines that begin with a "#". This character is
+	  used in FLYS as the beginning of a comment line.
+
 2011-12-22	Felix Wolfsteller	<felix.wolfsteller@intevation.de>
 
 	* src/main/java/de/intevation/flys/client/client/ui/chart/CrossSectionChartThemePanel.java:
--- a/flys-client/src/main/java/de/intevation/flys/client/server/CSVExportServiceImpl.java	Thu Dec 22 09:23:42 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/CSVExportServiceImpl.java	Thu Dec 22 09:28:22 2011 +0000
@@ -1,5 +1,6 @@
 package de.intevation.flys.client.server;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import java.io.Reader;
@@ -64,12 +65,24 @@
         requestDoc.appendChild(action);
 
         HttpClient client = new HttpClientImpl(url, locale);
+
         try {
             InputStream in = client.collectionOut(requestDoc, uuid, "export");
             Reader reader       = new InputStreamReader (in, "UTF-8");
             CSVReader csvReader = new CSVReader (reader);
 
-            return (List<String[]>) csvReader.readAll ();
+            List<String[]> lines = new ArrayList<String[]>();
+            String[]       line  = null;
+
+            while ((line = csvReader.readNext()) != null) {
+                if (line != null && line.length > 0) {
+                    if (!line[0].startsWith("#")) {
+                        lines.add(line);
+                    }
+                }
+            }
+
+            return lines;
         }
         catch (IOException ce) {
             logger.error(ce.getLocalizedMessage());

http://dive4elements.wald.intevation.org