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 2021/01/07 12:25:25 UTC

[Bug 65065] New: NullPointerException in org.apache.poi.xssf.usermodel.XSSFCellStyle#cloneStyleFrom

https://bz.apache.org/bugzilla/show_bug.cgi?id=65065

            Bug ID: 65065
           Summary: NullPointerException in
                    org.apache.poi.xssf.usermodel.XSSFCellStyle#cloneStyle
                    From
           Product: POI
           Version: 4.1.2-FINAL
          Hardware: PC
                OS: Mac OS X 10.1
            Status: NEW
          Severity: major
          Priority: P2
         Component: XSSF
          Assignee: dev@poi.apache.org
          Reporter: liugenshui2012@163.com
  Target Milestone: ---

Exception:
Exception in thread "main" java.lang.NullPointerException
        at
org.apache.poi.xssf.model.StylesTable.getNumberFormatId(StylesTable.java:273)
        at
org.apache.poi.xssf.model.StylesTable.putNumberFormat(StylesTable.java:295)
        at
org.apache.poi.xssf.usermodel.XSSFDataFormat.getFormat(XSSFDataFormat.java:52)
        at
org.apache.poi.xssf.usermodel.XSSFCellStyle.cloneStyleFrom(XSSFCellStyle.java:185)
        at
com.genshui.excel.ExcelStyleTest.copyCellStyle(ExcelStyleTest.java:56)
        at com.genshui.excel.ExcelStyleTest.main(ExcelStyleTest.java:29)


it actually happened in org.apache.poi.xssf.model.StylesTable#getNumberFormatId
when the map numberFormats has a null value

-- 
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 65065] NullPointerException in org.apache.poi.xssf.usermodel.XSSFCellStyle#cloneStyleFrom

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

Andreas Beeker <ki...@apache.org> changed:

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

--- Comment #1 from Andreas Beeker <ki...@apache.org> ---
as usual: please attach the causing 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 65065] NullPointerException in org.apache.poi.xssf.usermodel.XSSFCellStyle#cloneStyleFrom

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

--- Comment #2 from liugenshui2012@163.com ---
Created attachment 37693
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37693&action=edit
the causing Excel file

the causing 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 65065] NullPointerException in org.apache.poi.xssf.usermodel.XSSFCellStyle#cloneStyleFrom

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

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 65065] NullPointerException in org.apache.poi.xssf.usermodel.XSSFCellStyle#cloneStyleFrom

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

PJ Fanning <fa...@yahoo.com> changed:

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

--- Comment #5 from PJ Fanning <fa...@yahoo.com> ---
Closing as the test passes - reopen if you can provide a broken test scenario

-- 
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 65065] NullPointerException in org.apache.poi.xssf.usermodel.XSSFCellStyle#cloneStyleFrom

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

--- Comment #4 from PJ Fanning <fa...@yahoo.com> ---
I wrote a test case that parsed the attached xlsx and tried to clone all its
styles and had no issues (latest poi trunk code). In the snippet below, I
renamed the test file. 

```
    void test65065() throws IOException {
        try (XSSFWorkbook wb = openSampleWorkbook("bug65065.xlsx")) {
            int size = wb.getStylesSource().getNumCellStyles();
            for (int i = 0; i < size; i++) {
                XSSFCellStyle style = wb.getStylesSource().getStyleAt(i);
                wb.createCellStyle().cloneStyleFrom(style);
            }
        }
    }
```

-- 
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 65065] NullPointerException in org.apache.poi.xssf.usermodel.XSSFCellStyle#cloneStyleFrom

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

--- Comment #3 from liugenshui2012@163.com ---
(In reply to Andreas Beeker from comment #1)
> as usual: please attach the causing Excel file

the causing Excel file see Comment 2

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