Author: jleroux Date: Fri Sep 22 07:33:55 2017 New Revision: 1809270 URL: http://svn.apache.org/viewvc?rev=1809270&view=rev Log: Fixed: Empty rows affect the imported (OFBIZ-9728)
ofbiz-plugins pricat Component Affected by the empty rows, the number of rows actually imported is less than rows of excel. Thanks: Zhang Liang Modified: ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java Modified: ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java?rev=1809270&r1=1809269&r2=1809270&view=diff ============================================================================== --- ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java (original) +++ ofbiz/ofbiz-plugins/trunk/pricat/src/main/java/org/apache/ofbiz/pricat/sample/SamplePricatParser.java Fri Sep 22 07:33:55 2017 @@ -27,17 +27,7 @@ import java.util.List; import java.util.Locale; import java.util.Map; -import org.apache.poi.POIXMLException; -import org.apache.poi.hssf.usermodel.HSSFDataFormatter; -import org.apache.poi.ss.util.CellReference; -import org.apache.poi.xssf.usermodel.XSSFCell; -import org.apache.poi.xssf.usermodel.XSSFRow; -import org.apache.poi.xssf.usermodel.XSSFSheet; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.commons.fileupload.FileItem; -import org.apache.ofbiz.pricat.AbstractPricatParser; -import org.apache.ofbiz.htmlreport.InterfaceReport; -import org.apache.ofbiz.order.finaccount.FinAccountHelper; import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.UtilMisc; import org.apache.ofbiz.base.util.UtilProperties; @@ -46,8 +36,18 @@ import org.apache.ofbiz.entity.Delegator import org.apache.ofbiz.entity.GenericEntityException; import org.apache.ofbiz.entity.GenericValue; import org.apache.ofbiz.entity.transaction.GenericTransactionException; +import org.apache.ofbiz.htmlreport.InterfaceReport; +import org.apache.ofbiz.order.finaccount.FinAccountHelper; +import org.apache.ofbiz.pricat.AbstractPricatParser; import org.apache.ofbiz.service.LocalDispatcher; import org.apache.ofbiz.service.ServiceUtil; +import org.apache.poi.POIXMLException; +import org.apache.poi.hssf.usermodel.HSSFDataFormatter; +import org.apache.poi.ss.util.CellReference; +import org.apache.poi.xssf.usermodel.XSSFCell; +import org.apache.poi.xssf.usermodel.XSSFRow; +import org.apache.poi.xssf.usermodel.XSSFSheet; +import org.apache.poi.xssf.usermodel.XSSFWorkbook; /** * Sample pricat excel parser. @@ -185,7 +185,7 @@ public class SamplePricatParser extends } public void parseRowByRow(XSSFSheet sheet) { - int rows = sheet.getPhysicalNumberOfRows(); + int rows = sheet.getLastRowNum() + 1; List<Object[]> colNames = ColNamesList.get(pricatFileVersion); int colNumber = colNames.size();