https://bz.apache.org/bugzilla/show_bug.cgi?id=57923
Bug ID: 57923
Summary: ArrayIndexOutOfBoundsException in
org.apache.poi.hssf.record.NameRecord.getExternSheetNu
mer()
Product: POI
Version: 3.11-FINAL
Hardware: PC
Status: NEW
Severity: critical
Priority: P2
Component: HSSF
Assignee: [email protected]
Reporter: [email protected]
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;
}
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]