You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ni...@apache.org on 2011/03/18 16:51:39 UTC

svn commit: r1082958 - in /poi/trunk: src/documentation/content/xdocs/status.xml src/java/org/apache/poi/hssf/record/ExternalNameRecord.java src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java test-data/spreadsheet/49219.xls

Author: nick
Date: Fri Mar 18 15:51:39 2011
New Revision: 1082958

URL: http://svn.apache.org/viewvc?rev=1082958&view=rev
Log:
Fix bug #49219 - ExternalNameRecord can have a DDE Link entry without an operation

Added:
    poi/trunk/test-data/spreadsheet/49219.xls   (with props)
Modified:
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=1082958&r1=1082957&r2=1082958&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Fri Mar 18 15:51:39 2011
@@ -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>

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java?rev=1082958&r1=1082957&r2=1082958&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/ExternalNameRecord.java Fri Mar 18 15:51:39 2011
@@ -176,14 +176,16 @@ public final class ExternalNameRecord ex
             // 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();

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java?rev=1082958&r1=1082957&r2=1082958&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java Fri Mar 18 15:51:39 2011
@@ -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());
+    }
 }

Added: poi/trunk/test-data/spreadsheet/49219.xls
URL: http://svn.apache.org/viewvc/poi/trunk/test-data/spreadsheet/49219.xls?rev=1082958&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/test-data/spreadsheet/49219.xls
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org