See question 20 from the POI FAQ [1].  Accessing the same document objects
from multiple threads is not supported.

[1] https://poi.apache.org/faq.html

On Thu, Aug 23, 2018 at 3:47 AM Pavel Drankov <titant...@gmail.com> wrote:

> Hi,
>
> I have an instance of SXSSFSheet and when I'm trying to fill it with
> values concurrently, such exceptions occurs:
>
> java.util.ConcurrentModificationException: null
> at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1211)
> ~[na:1.8.0_152]
> at java.util.TreeMap$EntryIterator.next(TreeMap.java:1247) ~[na:1.8.0_152]
> at java.util.TreeMap$EntryIterator.next(TreeMap.java:1242) ~[na:1.8.0_152]
> at org.apache.poi.xssf.streaming.SXSSFSheet.getRowNum(SXSSFSheet.java:1851)
> ~[poi-ooxml-3.14.jar:3.14]
> at org.apache.poi.xssf.streaming.SXSSFRow.getRowNum(SXSSFRow.java:218)
> ~[poi-ooxml-3.14.jar:3.14]
> at org.apache.poi.xssf.streaming.SXSSFCell.getRowIndex(SXSSFCell.java:84)
> ~[poi-ooxml-3.14.jar:3.14]
> at org.apache.poi.xssf.streaming.SXSSFCell.setHyperlink(SXSSFCell.java:649)
> ~[poi-ooxml-3.14.jar:3.14]
>
> java.lang.NullPointerException: null
> at
>
> org.apache.poi.xssf.streaming.AutoSizeColumnTracker.updateColumnWidths(AutoSizeColumnTracker.java:302)
> ~[poi-ooxml-3.14.jar:3.14]
> at
> org.apache.poi.xssf.streaming.SXSSFSheet.flushOneRow(SXSSFSheet.java:1834)
> ~[poi-ooxml-3.14.jar:3.14]
> at org.apache.poi.xssf.streaming.SXSSFSheet.flushRows(SXSSFSheet.java:1813)
> ~[poi-ooxml-3.14.jar:3.14]
> at org.apache.poi.xssf.streaming.SXSSFSheet.createRow(SXSSFSheet.java:155)
> ~[poi-ooxml-3.14.jar:3.14]
>
> I put synchronization on the object access and it works fine now, but is
> not it an issue? Should the SXSSFCell and SXSSFSheet objects be thread
> safe?
>
> Best  wishes,
> Pavel
>

Reply via email to