poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r636756 - in /poi/trunk/src: documentation/content/xdocs/ java/org/apache/poi/hssf/util/ testcases/org/apache/poi/hssf/data/ testcases/org/apache/poi/hssf/usermodel/
Date Thu, 13 Mar 2008 13:20:12 GMT
Author: nick
Date: Thu Mar 13 06:20:09 2008
New Revision: 636756

URL: http://svn.apache.org/viewvc?rev=636756&view=rev
Log:
Fix bug #44593 - improved handling of short DVRecords

Added:
    poi/trunk/src/testcases/org/apache/poi/hssf/data/Bug44593.xls   (with props)
Modified:
    poi/trunk/src/documentation/content/xdocs/changes.xml
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/java/org/apache/poi/hssf/util/HSSFCellRangeAddress.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestBugs.java

Modified: poi/trunk/src/documentation/content/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/changes.xml?rev=636756&r1=636755&r2=636756&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/changes.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/changes.xml Thu Mar 13 06:20:09 2008
@@ -36,6 +36,7 @@
 
 		<!-- Don't forget to update status.xml too! -->
         <release version="3.1-beta1" date="2008-??-??">
+           <action dev="POI-DEVELOPERS" type="add">44593 - Improved handling of short
DVRecords</actions>
            <action dev="POI-DEVELOPERS" type="add">28627 / 44580 - Fix Range.delete()
in HWPF</action>
            <action dev="POI-DEVELOPERS" type="add">44539 - Support for area references
in formulas of rows >= 32768</action>
            <action dev="POI-DEVELOPERS" type="add">44536 - Improved support for detecting
read-only recommended files</action>

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=636756&r1=636755&r2=636756&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Thu Mar 13 06:20:09 2008
@@ -33,6 +33,7 @@
 	<!-- Don't forget to update changes.xml too! -->
     <changes>
         <release version="3.1-beta1" date="2008-??-??">
+           <action dev="POI-DEVELOPERS" type="add">44593 - Improved handling of short
DVRecords</actions>
            <action dev="POI-DEVELOPERS" type="add">28627 / 44580 - Fix Range.delete()
in HWPF</action>
            <action dev="POI-DEVELOPERS" type="add">44539 - Support for area references
in formulas of rows >= 32768</action>
            <action dev="POI-DEVELOPERS" type="add">44536 - Improved support for detecting
read-only recommended files</action>

Modified: poi/trunk/src/java/org/apache/poi/hssf/util/HSSFCellRangeAddress.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/util/HSSFCellRangeAddress.java?rev=636756&r1=636755&r2=636756&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/util/HSSFCellRangeAddress.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/util/HSSFCellRangeAddress.java Thu Mar 13 06:20:09
2008
@@ -18,6 +18,9 @@
 
 import org.apache.poi.hssf.record.RecordInputStream;
 import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.POILogFactory;
+import org.apache.poi.util.POILogger;
+
 import java.util.ArrayList;
 
 /**
@@ -38,6 +41,8 @@
 
 public class HSSFCellRangeAddress
 {
+	private static POILogger logger = POILogFactory.getLogger(HSSFCellRangeAddress.class);
+	
     /**
      * Number of following ADDR structures
      */
@@ -74,8 +79,19 @@
 		{
             short first_row = in.readShort(); 
             short first_col = in.readShort();
-            short last_row  = in.readShort();
-            short last_col  = in.readShort();
+            
+            short last_row  = first_row;
+            short last_col  = first_col;
+            if(in.remaining() >= 4) {
+	            last_row  = in.readShort();
+	            last_col  = in.readShort();
+            } else {
+            	// Ran out of data
+            	// For now, issue a warning, finish, and 
+            	//  hope for the best....
+            	logger.log(POILogger.WARN, "Ran out of data reading cell references for DVRecord");
+            	k = this.field_addr_number;
+            }
 
 			AddrStructure region = new AddrStructure(first_row, first_col, last_row, last_col);
 			this.field_regions_list.add(region);

Added: poi/trunk/src/testcases/org/apache/poi/hssf/data/Bug44593.xls
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/data/Bug44593.xls?rev=636756&view=auto
==============================================================================
Binary file - no diff available.

Propchange: poi/trunk/src/testcases/org/apache/poi/hssf/data/Bug44593.xls
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

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=636756&r1=636755&r2=636756&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 Thu Mar 13 06:20:09
2008
@@ -1127,6 +1127,23 @@
         in.close();
         assertFalse(wb.isWriteProtected());
     }
+    
+    /**
+     * Some files were having problems with the DVRecord,
+     *  probably due to dropdowns
+     */
+    public void test44593() throws Exception {
+        FileInputStream in = new FileInputStream(new File(cwd, "Bug44593.xls"));
+        
+        // Used to blow up with an IllegalArgumentException
+        //  when creating a DVRecord
+        // Now won't, but no idea if this means we have
+        //  rubbish in the DVRecord or not...
+        HSSFWorkbook wb = new HSSFWorkbook(in);
+        in.close();
+        
+        assertEquals(2, wb.getNumberOfSheets());
+    }
 }
 
 



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


Mime
View raw message