Re: XSSFEvaluationWorkbook.getSheet can throw ArrayIndexOutOfBoundsException

2021-11-01 Thread Dominik Stadler
Hi, N.p., thanks for all the testing, I still found a potential problem when adding/removing sheets while using the Evaluator, which can be handled gracefully fairly easily, so this will be done better in an upcoming version. Thanks Dominik. On Sun, Oct 31, 2021 at 9:39 AM Andreas Reichel <

Re: XSSFEvaluationWorkbook.getSheet can throw ArrayIndexOutOfBoundsException

2021-10-31 Thread Andreas Reichel
On Sun, 2021-10-31 at 00:29 +0700, Andreas Reichel wrote: > but I still maintain my point, that I have added all > the sheets first before I evaluated anything. Dominik and Team, unfortunately I stand corrected: I ran this against large data many times since yesterday and have never been able t

Re: XSSFEvaluationWorkbook.getSheet can throw ArrayIndexOutOfBoundsException

2021-10-30 Thread Andreas Reichel
Greetings. On Sat, 2021-10-30 at 18:03 +0200, Dominik Stadler wrote: > If you use multi-threading in your big application, Nope, not within this particular Spreadsheet builder. >  you have to ensure that > a single Workbook is never used in multiple threads at the same time. Yes, am fully aware

Re: XSSFEvaluationWorkbook.getSheet can throw ArrayIndexOutOfBoundsException

2021-10-30 Thread Dominik Stadler
Thanks for trying. If you use multi-threading in your big application, you have to ensure that a single Workbook is never used in multiple threads at the same time. POI ensures that global/static caches are synchronized, but work on a single Workbook is not synchronized, so you should synchronize

Re: XSSFEvaluationWorkbook.getSheet can throw ArrayIndexOutOfBoundsException

2021-10-30 Thread Andreas Reichel
Dominik and Team, I did my very best to create an isolated Test Case. The attached file does exactly what I do in the production (without database, formatting and less formulas). But for whatever reason it never triggers the Exception. The flow and the business logic is exactly the same. Only dif

Re: XSSFEvaluationWorkbook.getSheet can throw ArrayIndexOutOfBoundsException

2021-10-30 Thread Andreas Reichel
Greetings Dominik. thanks for the feedback. I actually assumed already a similar thing and it is worth to note that my Workbook is completely code generated (with many sheets and references in between the sheets). However, based on my suspicion I actually created all Sheets and Cells and Formulas

Re: XSSFEvaluationWorkbook.getSheet can throw ArrayIndexOutOfBoundsException

2021-10-30 Thread Dominik Stadler
Hi, I can reproduce it if you keep the instance of the FormulaEvaluator while adding more sheets to the workbook between calls to evaluateXXX() as then internal caches get confused. Workaround is to either create all sheets up-front or re-create the Evaluator or use clearAllCachedResultValues() t

Re: XSSFEvaluationWorkbook.getSheet can throw ArrayIndexOutOfBoundsException

2021-10-30 Thread Dominik Stadler
Hi, Sounds like a strange case as there is a check right before that line which should trigger a more specific error message, but somehow it is not triggered. Can you create an issue and if possible share a sample workbook which shows this problem? Thanks... Dominik. On Sat, Oct 30, 2021 at 12:

Re: XSSFEvaluationWorkbook.getSheet can throw ArrayIndexOutOfBoundsException

2021-10-30 Thread Andreas Reichel
On Sat, 2021-10-30 at 11:42 +, PJ Fanning wrote: > Can you raise an issue and add a reproducible test case? Once we have > a reproducible test case, someone can have a look. Sure thing, thank you so much for prompt turn around. Have a great weekend. Andreas

Re: XSSFEvaluationWorkbook.getSheet can throw ArrayIndexOutOfBoundsException

2021-10-30 Thread PJ Fanning
Hi Andreas, This looks like a bug. Can you raise an issue and add a reproducible test case? Once we have a reproducible test case, someone can have a look. Regards, PJ On Saturday 30 October 2021, 11:21:36 IST, Andreas Reichel wrote: Greetings POI team. Using Apache POI 5.0 I wou

XSSFEvaluationWorkbook.getSheet can throw ArrayIndexOutOfBoundsException

2021-10-30 Thread Andreas Reichel
Greetings POI team. Using Apache POI 5.0 I would like evaluate all Cells in order to auto- size all columns in all sheets: FormulaEvaluator evaluator = workbook.getCreationHelper().createFormulaEvaluator(); for (int i =0; i