bug 27852 - patch by Brice Copy

git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@353658 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Avik Sengupta 2005-04-28 14:31:00 +00:00
parent 8b20b4a4db
commit 8b1e706aeb
3 changed files with 18 additions and 2 deletions

View File

@ -617,7 +617,7 @@ public class NameRecord extends Record {
* @return extern sheet index * @return extern sheet index
*/ */
public short getExternSheetNumber(){ public short getExternSheetNumber(){
if (field_13_name_definition == null) return 0; if (field_13_name_definition == null || field_13_name_definition.isEmpty()) return 0;
Ptg ptg = (Ptg) field_13_name_definition.peek(); Ptg ptg = (Ptg) field_13_name_definition.peek();
short result = 0; short result = 0;
@ -664,7 +664,7 @@ public class NameRecord extends Record {
* @return area reference * @return area reference
*/ */
public String getAreaReference(Workbook book){ public String getAreaReference(Workbook book){
if (field_13_name_definition == null) return "#REF!"; if (field_13_name_definition == null || field_13_name_definition.isEmpty()) return "#REF!";
Ptg ptg = (Ptg) field_13_name_definition.peek(); Ptg ptg = (Ptg) field_13_name_definition.peek();
String result = ""; String result = "";

Binary file not shown.

View File

@ -491,6 +491,22 @@ extends TestCase {
assertTrue("No Exceptions while reading file", true); assertTrue("No Exceptions while reading file", true);
} }
/**names and macros */
public void test27852() throws java.io.IOException {
String filename = System.getProperty("HSSF.testdata.path");
filename=filename+"/27852.xls";
FileInputStream in = new FileInputStream(filename);
HSSFWorkbook wb = new HSSFWorkbook(in);
assertTrue("No Exceptions while reading file", true);
for(int i = 0 ; i < wb.getNumberOfNames() ; i++)
{
HSSFName name = wb.getNameAt(i);
name.getNameName();
name.getReference();
}
assertTrue("No Exceptions till here!", true);
}
} }