bugfix for ExcelUtils excel line reader
authorAndreas Müller <a.mueller@bgbm.org>
Wed, 11 May 2011 10:41:45 +0000 (10:41 +0000)
committerAndreas Müller <a.mueller@bgbm.org>
Wed, 11 May 2011 10:41:45 +0000 (10:41 +0000)
cdmlib-commons/src/main/java/eu/etaxonomy/cdm/common/ExcelUtils.java

index c8ba014d138faf542cfd296b158b091440825970..c03f695f39de8e18db996933380e1dbaa780ad3a 100644 (file)
@@ -72,7 +72,6 @@ public class ExcelUtils {
                                }
                        }
                }
-               HashMap<String, String> headers = null;
                ArrayList<String> columns = new ArrayList<String>();
                row = sheet.getRow(0);
                for (int c = 0; c < cols; c++){
@@ -86,12 +85,11 @@ public class ExcelUtils {
                }
                for(int r = 1; r < rows; r++) {
                        row = sheet.getRow(r);
-                       headers = new HashMap<String, String>();
+                       HashMap<String, String> headers = new HashMap<String, String>();
                        boolean notEmpty = false;
-                       for (int j = 0; j<row.getRowNum(); j++){
+                       for (int j = 0; j<row.getLastCellNum(); j++){
                                if (row.getCell(j) != null){
                                        notEmpty = true;
-                                       break;
                                }
                        }
                        if(row != null && notEmpty) {