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 2014/05/05 18:56:18 UTC

[Bug 56490] New: When trying to open xlsx file exported from a tool, null pointer exception

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

            Bug ID: 56490
           Summary: When trying to open xlsx file exported from a tool,
                    null pointer exception
           Product: POI
           Version: 3.10
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: baddamsravanthi@gmail.com

Created attachment 31590
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31590&action=edit
excel sheet

We have an xlsx file exported for a regular tool.
The file when we try open it using poi, throws null pointer exception.
But when the xlsx file is opened saved and closed then poi works fine.

-- 
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


[Bug 56490] When trying to open xlsx file exported from a tool, null pointer exception

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

Dominik Stadler <do...@gmx.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW

-- 
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


[Bug 56490] When trying to open xlsx file exported from a tool, null pointer exception

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

--- Comment #6 from Dominik Stadler <do...@gmx.at> ---
This file seems to be built in a way we do not expect at all, when I run the
following:

        for(Row row : sheet) {
            for(Cell cell : row) {
                System.out.println("Cell in Row: " + row.getRowNum() + ": " +
cell.toString());
            }
        }

It prints out the following, i.e. only one row with num "-1" is found where the
last value in the column is returned, irrespective of the row in which it
actually is, looks like all cells are added to the same "-1" row:

Cell in Row: -1: ThinkPad X240
Cell in Row: -1: Intel® Core™ i5-4200U processor (2 cores, 1.60GHz, 3MB cache)
Cell in Row: -1: Windows 8 Standard 64 - English
Cell in Row: -1: 12.5" HD WXGA (1366 X 768) LED Backlight w/ 720p HD Camera
Cell in Row: -1: Intel HD Graphics 4400
Cell in Row: -1: 4 GB PC3-12800 DDR3 SDRAM 1600MHz SODIMM Memory
Cell in Row: -1: 500GB, 7200RPM Serial ATA 2.5" Hard Drive
Cell in Row: -1: No Optical Included
Cell in Row: -1: $761.60

-- 
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


[Bug 56490] When trying to open xlsx file exported from a tool, null pointer exception

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

Nick Burch <ap...@gagravarr.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO
                 OS|                            |All

--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
Any chance you could post the stacktrace you get?

-- 
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


[Bug 56490] When trying to open xlsx file exported from a tool, null pointer exception

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

--- Comment #5 from sam <ba...@gmail.com> ---
I even tried to print all rows, it only prints the last row.

-- 
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


[Bug 56490] When trying to open xlsx file exported from a tool, null pointer exception

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

--- Comment #4 from sam <ba...@gmail.com> ---
public static void main(String[] args) throws IOException
    {

      FileInputStream fileIn = new FileInputStream("C:/Lenovo/Lenovo_A.xlsx");
        XSSFWorkbook filename = new XSSFWorkbook(fileIn);
        XSSFSheet sheet = filename.getSheetAt(0);    

        String columnWanted = "Link";
        Integer columnNo = null;
        List <Cell> cells = new ArrayList<Cell>();

        Row firstRow = sheet.getRow(0);
        for (Cell cell:firstRow){
            if(cell.getStringCellValue().equals(columnWanted)){
                columnNo = cell.getColumnIndex();
            }
        }

        if(columnNo != null){
            for (Row row: sheet){
                Cell c = row.getCell(columnNo);
                if(c == null || c.getCellType() == Cell.CELL_TYPE_BLANK){
                }
                else
                {
                    cells.add(c);
                }

                }

            }
      else
      {
          System.out.println("could not find column" + columnWanted + "in first
row of" + fileIn.toString());
          }
        }

I have this code. Now I get Exception in thread "main" at line for (Cell
cell:firstRow) with same excel file

-- 
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


[Bug 56490] When trying to open xlsx file exported from a tool, null pointer exception

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

--- Comment #2 from sam <ba...@gmail.com> ---
Exception in thread "main" java.lang.NullPointerException
    at
org.apache.poi.xssf.usermodel.XSSFWorkbook.onDocumentRead(XSSFWorkbook.java:284)
    at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:159)
    at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:221)
    at CompareData.Compare_Data.read_file(Compare_Data.java:68)
    at CompareData.Compare_Data.main(Compare_Data.java:50)

Line 67-69:
 FileInputStream fileIn2 = new FileInputStream(fn);
 XSSFWorkbook filename2 = new XSSFWorkbook(fileIn2);
 XSSFSheet sheet1 = filename2.getSheetAt(0);

-- 
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


[Bug 56490] When trying to open xlsx file exported from a tool, null pointer exception

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

Dominik Stadler <do...@gmx.at> changed:

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

--- Comment #3 from Dominik Stadler <do...@gmx.at> ---
I stumbled across the same in files produced by the Suunto Sports Watch export
on movescount.com, when taking a closer look I saw that the latest
trunk-version already has a fix via Bug 56278, so this one is actually a
duplicate.

*** This bug has been marked as a duplicate of bug 56278 ***

-- 
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


[Bug 56490] When trying to open xlsx file exported from a tool, null pointer exception

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

sam <ba...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |---

-- 
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