You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2010/01/22 10:30:44 UTC

DO NOT REPLY [Bug 48598] New: code migration problem

https://issues.apache.org/bugzilla/show_bug.cgi?id=48598

           Summary: code migration problem
           Product: POI
           Version: 3.5-FINAL
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: satishkk@collabera.com


We are using poi3.0.2.jar file.

where the code(attached) works fine for xls files

wb=WorkbookFactory.create(fin);
Sheet sheet = wb.getSheetAt(0);
Row row;
Cell cell;
for(int r = 0; r < rows; r++) {
    System.out.println();
    row = sheet.getRow(r);
    if(row != null) {
    for(int c = -1; c < cols; c++) {
    cell = row.getCell((short)c);
    }

where as if I  pass xlsx files its giving followig error.

java.lang.IllegalArgumentException: Cell index must be >= 0
    at org.apache.poi.xssf.usermodel.XSSFRow.getCell(XSSFRow.java:191)
    at org.apache.poi.xssf.usermodel.XSSFRow.getCell(XSSFRow.java:178)
    at org.apache.poi.xssf.usermodel.XSSFRow.getCell(XSSFRow.java:35)
    at ReadExcel.readBoth(ReadExcel.java:190)
    at ReadExcel.main(ReadExcel.java:39)

The problem is with row.getCell(-1)
this method returns null in POI3.0.2
the same method throws IllegalArgumentException in POI3.5

So we need to change the code?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 48598] code migration problem

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48598

satish <sa...@collabera.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |satishkk@collabera.com

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 48598] code migration problem

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48598

Nick Burch <ni...@alfresco.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID

--- Comment #1 from Nick Burch <ni...@alfresco.com> 2010-01-22 02:23:04 UTC ---
row.getCell(-1) is not a valid thing to ask for

As the error message tells you, cells start at 0. Either ask for cells from 0
onwards, or use an iterator.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org