aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Burch <nick@apache.org>2011-03-18 15:51:39 +0000
committerNick Burch <nick@apache.org>2011-03-18 15:51:39 +0000
commitaff049234a4826b2b8affbbcde666ae90ee2969c (patch)
tree52eab0742b186b6bd4b52dfbd000ea54761e407b
parentdd1af3acd92465e78451e0c3183dc8061338ae36 (diff)
downloadpoi-aff049234a4826b2b8affbbcde666ae90ee2969c.tar.gz
poi-aff049234a4826b2b8affbbcde666ae90ee2969c.zip
Fix bug #49219 - ExternalNameRecord can have a DDE Link entry without an operation
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1082958 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--src/documentation/content/xdocs/status.xml1
-rw-r--r--src/java/org/apache/poi/hssf/record/ExternalNameRecord.java18
-rw-r--r--src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java6
-rw-r--r--test-data/spreadsheet/49219.xlsbin0 -> 258560 bytes
4 files changed, 17 insertions, 8 deletions
diff --git a/src/documentation/content/xdocs/status.xml b/src/documentation/content/xdocs/status.xml
index e2e772a3c2..3ee716b135 100644
--- a/src/documentation/content/xdocs/status.xml
+++ b/src/documentation/content/xdocs/status.xml
@@ -34,6 +34,7 @@
<changes>
<release version="3.8-beta2" date="2011-??-??">
+ <action dev="poi-developers" type="fix">49219 - ExternalNameRecord support for DDE Link entries without an operation</action>
<action dev="poi-developers" type="fix">50846 - More XSSFColor theme improvements, this time for Cell Borders</action>
<action dev="poi-developers" type="fix">50939 - ChartEndObjectRecord is supposed to have 6 bytes at the end, but handle it not</action>
<action dev="poi-developers" type="add">HMEF - New component which supports TNEF (Transport Neutral Encoding Format), aka winmail.dat</action>
diff --git a/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java b/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java
index cb1c5ac25b..934cf431d4 100644
--- a/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java
+++ b/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java
@@ -176,14 +176,16 @@ public final class ExternalNameRecord extends StandardRecord {
// another switch: the fWantAdvise bit specifies whether the body describes
// an external defined name or a DDE data item
if(isAutomaticLink()){
- //body specifies DDE data item
- int nColumns = in.readUByte() + 1;
- int nRows = in.readShort() + 1;
-
- int totalCount = nRows * nColumns;
- _ddeValues = ConstantValueParser.parse(in, totalCount);
- _nColumns = nColumns;
- _nRows = nRows;
+ if(in.available() > 0) {
+ //body specifies DDE data item
+ int nColumns = in.readUByte() + 1;
+ int nRows = in.readShort() + 1;
+
+ int totalCount = nRows * nColumns;
+ _ddeValues = ConstantValueParser.parse(in, totalCount);
+ _nColumns = nColumns;
+ _nRows = nRows;
+ }
} else {
//body specifies an external defined name
int formulaLen = in.readUShort();
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
index e27ce841ab..590d096e11 100644
--- a/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
+++ b/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
@@ -2036,4 +2036,10 @@ if(1==2) {
HSSFWorkbook wb = openSample("50939.xls");
assertEquals(2, wb.getNumberOfSheets());
}
+
+ public void test49219() throws Exception {
+ HSSFWorkbook wb = openSample("49219.xls");
+ assertEquals(1, wb.getNumberOfSheets());
+ assertEquals("DGATE", wb.getSheetAt(0).getRow(1).getCell(0).getStringCellValue());
+ }
}
diff --git a/test-data/spreadsheet/49219.xls b/test-data/spreadsheet/49219.xls
new file mode 100644
index 0000000000..68605ea486
--- /dev/null
+++ b/test-data/spreadsheet/49219.xls
Binary files differ