diff flys-client/src/main/java/de/intevation/flys/client/server/CSVExportServiceImpl.java @ 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 bc06a671ef60
children 1f2f08211a5f
line wrap: on
line diff
--- 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