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

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@900745 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Nick Burch 2010-01-19 12:03:27 +00:00
parent 9780245c08
commit d7470746e1
1 changed files with 7 additions and 1 deletions

View File

@ -47,7 +47,13 @@ class SSTDeserializer
{ {
for (int i=0;i<stringCount;i++) { for (int i=0;i<stringCount;i++) {
// Extract exactly the count of strings from the SST record. // 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 ); addToStringTable( strings, str );
} }
} }