Bug 34727 - Exception thrown when trying to retrieve Font Field
Summary: Exception thrown when trying to retrieve Font Field
Status: RESOLVED DUPLICATE of bug 39190
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.0-FINAL
Hardware: Other Windows XP
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2005-05-03 19:29 UTC by Muhammed
Modified: 2006-08-27 04:06 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Muhammed 2005-05-03 19:29:40 UTC
From tracing the code, it seems that a FontRecord is created with byte 14 > 0
which in turn causes
field_10_font_name_len  > 0 causing unicode decoding code to be invoked which
produces the exception itself. I've followed the codepath and the data array is
filled directly from the inputstream, retrieving a +ve 124 for data[14].

Caused by: java.lang.IllegalArgumentException: Illegal length
    at org.apache.poi.util.StringUtil.getFromUnicodeLE(StringUtil.java:78)
    at org.apache.poi.hssf.record.FontRecord.fillFields(FontRecord.java:146)
    at org.apache.poi.hssf.record.Record.fillFields(Record.java:91)
    at org.apache.poi.hssf.record.Record.<init>(Record.java:55)
    at org.apache.poi.hssf.record.FontRecord.<init>(FontRecord.java:88)
    ... 25 more

The exception is thrown in getFromUnicodeLE but i havent encountered that method
usually being called to begin with. 

The font used itself is Arial so i'm not sure why its causing a problem.

The value for data[14]=124
The value for data[15]=109

Also when the getFromUnicodeLE function is called, the length of the byte array
titled string is 26 , the offset passed is 16 and the len paramater is 124. 
Printing out the function  header 
getFromUnicodeLE(final byte[] string,final int offset,final int len)
and I get getFromUnicodeLE([B@1f436f5,16,124)

Also I got the same problem with 2.0 FINAL and the HEAD version I checked out
from CVS
Comment 1 Jason Height 2006-07-28 03:26:14 UTC
Can you upload a excel file causing the issue, or recheck against the latest svn

Comment 2 Jason Height 2006-08-27 11:06:59 UTC

*** This bug has been marked as a duplicate of 39190 ***