Bug 14624

Summary: Error when reading some xls file
Product: POI Reporter: Michele Franceschi <m.franceschi>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED WONTFIX    
Severity: normal    
Priority: P3    
Version: 1.5.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Attachments: file excel (XP) with password protection

Description Michele Franceschi 2002-11-17 09:07:08 UTC
CODE:
public class XSLExample {

  public XSLExample() {
  }

  public static void main(String[] args) throws IOException {
    POIFSFileSystem fs =  new POIFSFileSystem(new FileInputStream("sqm.xls"));
    HSSFWorkbook wb = new HSSFWorkbook(fs);

    System.out.println("Tot Sheet: " + wb.getNumberOfSheets());
    for (int i=0; i < wb.getNumberOfSheets(); i++) {
      System.out.println(wb.getSheetName(i));
    }
  }
}

ERROR:
java.lang.reflect.InvocationTargetException: 
java.lang.IllegalArgumentException: Illegal length
	at org.apache.poi.util.StringUtil.getFromUnicodeHigh
(StringUtil.java:115)
	at org.apache.poi.hssf.record.FontRecord.fillFields
(FontRecord.java:172)
	at org.apache.poi.hssf.record.Record.fillFields(Record.java:143)
	at org.apache.poi.hssf.record.Record.<init>(Record.java:105)
	at org.apache.poi.hssf.record.FontRecord.<init>(FontRecord.java:125)
	at java.lang.reflect.Constructor.newInstance(Native Method)
	at org.apache.poi.hssf.record.RecordFactory.createRecord
(RecordFactory.java:254)
	at org.apache.poi.hssf.record.RecordFactory.createRecords
(RecordFactory.java:192)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:181)
	at innesto.XSLExample.main(XSLExample.java:24)
org.apache.poi.hssf.record.RecordFormatException: Unable to construct record 
instance, the following exception occured: null
	at org.apache.poi.hssf.record.RecordFactory.createRecord
(RecordFactory.java:267)
	at org.apache.poi.hssf.record.RecordFactory.createRecords
(RecordFactory.java:192)
	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>
(HSSFWorkbook.java:181)
	at innesto.XSLExample.main(XSLExample.java:24)
Exception in thread "main"
Comment 1 Michele Franceschi 2002-11-18 14:31:06 UTC
Created attachment 3876 [details]
file excel (XP) with  password protection
Comment 2 Andy Oliver 2002-11-18 16:36:26 UTC
http://jakarta.apache.org/poi/faq.html#faq-5