Bug 16381

Summary: getRow returning null even when populated rows are present.
Product: POI Reporter: Amitabh <vermaamitabh>
Component: HSSFAssignee: POI Developers List <dev>
Severity: major    
Priority: P3    
Version: 2.0-dev   
Target Milestone: ---   
Hardware: PC   
OS: All   
Attachments: Test XL file

Description Amitabh 2003-01-24 04:26:30 UTC
I m using poi1.8-dev and my java version is 1.1.3_04.

I m using poi to read and append to mid size excel
files(around 2 MB) containing several sheets.
After around 30th row it returns a null through I can see in the file that the
row is populated.
The running code which i use is below. I m attaching the XL file as well.
import java.io.*;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import java.util.Vector;
import java.util.Iterator; 

public class SkuReadTest18

    public SkuReadTest18()

    public static void main(String args[])
       throws IOException
       POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream("C:\\tc30
       HSSFWorkbook wb = new HSSFWorkbook(fs);
       HSSFSheet sheet;
       HSSFRow row;
       HSSFRow r;
       HSSFCell cell;
       HSSFCell cell1;
       HSSFCell parcell;
       String xxx;
       int j=0;
       int i;
       int celltype,k ;
       String yyy;
       int shtno = wb.getNumberOfSheets();
       Vector vec = new Vector(500);
       System.out.println("The number of sheets is " + shtno);
       for ( i = 0; i <shtno; i++)
        try {
             sheet = wb.getSheetAt(i);
             row = sheet.getRow(2);
             cell = row.getCell((short)0);
             celltype = cell.getCellType();
             System.out.println("cell type is " + celltype);
             if (celltype==1)
                 xxx = cell.getStringCellValue().toString();
                 System.out.println("The Parent value is "+ xxx);
                 cell1 =null;
                 if (xxx.equals("PARENT_PART_NUM"))
            		Iterator rows = sheet.rowIterator();
            		r = (HSSFRow)rows.next();                        
                  		r = (HSSFRow)rows.next();
            			r = (HSSFRow)rows.next();	    
            			cell1 = r.getCell((short)0);
        	   		if (cell1!=null)         	   
        				yyy = cell1.getStringCellValue();
        				System.out.println("yyy at j =" +j 
+ "is .."+ yyy);
        	        		if (yyy.length()>0)
	}catch (Exception e)
    	}//else continue;

	System.out.println("The Vector is "+vec.size());
Comment 1 Amitabh 2003-01-24 04:34:48 UTC
Created attachment 4527 [details]
Test XL file
Comment 2 Amitabh 2003-01-24 04:36:42 UTC
The excel version is excel-2000.
Comment 3 Andy Oliver 2003-02-08 18:42:20 UTC
submit a simpler runnable .java file and attach it.  (then you can reopen)