poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject svn commit: r900745 - /poi/trunk/src/java/org/apache/poi/hssf/record/SSTDeserializer.java
Date Tue, 19 Jan 2010 12:03:27 GMT
Author: nick
Date: Tue Jan 19 12:03:27 2010
New Revision: 900745

URL: http://svn.apache.org/viewvc?rev=900745&view=rev
Log:
If there's no more data but there ought to be for unicode strings, in a partly corrupt file,
give a warning and substitute in empty strings

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

Modified: poi/trunk/src/java/org/apache/poi/hssf/record/SSTDeserializer.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/java/org/apache/poi/hssf/record/SSTDeserializer.java?rev=900745&r1=900744&r2=900745&view=diff
==============================================================================
--- poi/trunk/src/java/org/apache/poi/hssf/record/SSTDeserializer.java (original)
+++ poi/trunk/src/java/org/apache/poi/hssf/record/SSTDeserializer.java Tue Jan 19 12:03:27
2010
@@ -47,7 +47,13 @@
     {
       for (int i=0;i<stringCount;i++) {
          // Extract exactly the count of strings from the SST record.
-         UnicodeString str = new UnicodeString(in);
+         UnicodeString str;
+         if(in.available() == 0 && ! in.hasNextRecord()) {
+            System.err.println("Ran out of data before creating all the strings! String at
index " + i + "");
+            str = new UnicodeString("");
+         } else {
+            str = new UnicodeString(in);
+         }
          addToStringTable( strings, str );
       }
     }



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


Mime
View raw message