Hey Guys, We have a problem with the POI API. We want to check whether the external spreadsheet, to which a formula refers, is integrated properly. For this we call the method HSSFName.getSheetName (). During this call, we get an ArrayIndexOutOfBoundsException. The reason is that, in this case the object Name (Konrekt HSSFName) does not refer to any formula and there is accordingly no PTGs. That's why flies here "Ptg PTG = field_13_name_definition.getTokens () [0];" a ArrayIndexOutOfBoundsException. Our suggestion would be as follows: The method org.apache.poi.hssf.record.NameRecord.getExternSheetNumer () should be rewritten: public int getExternSheetNumber(){ Ptg[] ptgs = field_13_name_definition.getTokens(); if (ptgs.lenght < 1) { return 0; } Ptg ptg = ptgs[0]; if (ptg.getClass() == Area3DPtg.class){ return ((Area3DPtg) ptg).getExternSheetIndex(); } if (ptg.getClass() == Ref3DPtg.class){ return ((Ref3DPtg) ptg).getExternSheetIndex(); } return 0; }
Any chance you could retest with 3.12 final?
The Problem still occurs in the version 3.12 Final
Can you provide a sample file and sample code which shows the Exception on HSSFName.getSheetName()
Nevermind, the following is sufficient to reproduce the problem: NameRecord record = new NameRecord(); assertEquals(0, record.getExternSheetNumber()); this is fixed via r1686689 now.
Is the fix also available in Version 3.11? How can i get the actuel POI-Version with the fix?
We usually don't backport features, only for CVEs. So you need to grab a nightly until we push the next beta or final release. See [1] or [2] for download infos [1] http://poi.apache.org/download.html [2] https://builds.apache.org/job/POI/lastSuccessfulBuild/artifact/build/dist/