Author: maxcom
Date: Fri Jan 15 12:25:15 2010
New Revision: 899608

URL: http://svn.apache.org/viewvc?rev=899608&view=rev
Log:
bug#48068: RecordFormatException: The content of an excel record cannot exceed 
8224 bytes

Modified:
    poi/trunk/src/java/org/apache/poi/hssf/record/RecordFactoryInputStream.java
    poi/trunk/src/java/org/apache/poi/hssf/record/RecordInputStream.java

Modified: 
poi/trunk/src/java/org/apache/poi/hssf/record/RecordFactoryInputStream.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/RecordFactoryInputStream.java?rev=899608&r1=899607&r2=899608&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/RecordFactoryInputStream.java 
(original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/RecordFactoryInputStream.java 
Fri Jan 15 12:25:15 2010
@@ -218,21 +218,21 @@
                                return null;
                        }
 
-                       // step underlying RecordInputStream to the next record
-                       _recStream.nextRecord();
-
                        if (_lastRecordWasEOFLevelZero) {
                                // Potential place for ending the workbook 
stream
                                // Check that the next record is not 
BOFRecord(0x0809)
                                // Normally the input stream contains only zero 
padding after the last EOFRecord,
-                               // but bug 46987 suggests that the padding may 
be garbage.
+                               // but bug 46987 and 48068 suggests that the 
padding may be garbage.
                                // This code relies on the padding bytes not 
starting with BOFRecord.sid
-                               if (_recStream.getSid() != BOFRecord.sid) {
+                               if (_recStream.getNextSid() != BOFRecord.sid) {
                                        return null;
                                }
                                // else - another sheet substream starting here
                        }
 
+            // step underlying RecordInputStream to the next record
+            _recStream.nextRecord();
+
                        r = readNextRecord();
                        if (r == null) {
                                // some record types may get skipped (e.g. 
DBCellRecord and ContinueRecord)

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/RecordInputStream.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/RecordInputStream.java?rev=899608&r1=899607&r2=899608&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/RecordInputStream.java 
(original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/RecordInputStream.java Fri 
Jan 15 12:25:15 2010
@@ -428,4 +428,11 @@
                //    and before the formatting run data)
                return _nextSid == ContinueRecord.sid;
        }
+
+    /**
+     @requrn sid of next record. Can be called after hasNextRecord()  
+     */
+    public int getNextSid() {
+        return _nextSid;
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to