Bug 17922

Summary: Can't open excel file with both workbook and sheet protected.
Product: POI Reporter: Jim Shen <jim.shen>
Component: HSSFAssignee: POI Developers List <dev>
Status: RESOLVED INVALID    
Severity: critical    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Jim Shen 2003-03-12 16:14:13 UTC
I was trying to open the excel file for read-only using POI.The file was both 
workbook and sheet protected. The file couldn't be opened and caused the 
following exception: 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
        at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.j
ava:252)
        at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.
java:190)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:1
81)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:1
53)
        at gov.moh.ohfs.submission.SPSubmissionForm.init(SPSubmissionForm.java:1
05)
        at gov.moh.ohfs.submission.SPSubmission.importSPData(SPSubmission.java:2
52)
        at gov.moh.ohfs.submission.SPSubmission.process(SPSubmission.java:192)
        at gov.moh.ohfs.report.generation.ReportGenController.processFacility(Re
portGenController.java:387)
        at gov.moh.ohfs.report.generation.ReportGenController.main(ReportGenCont
roller.java:621)
Caused by: java.lang.IllegalArgumentException: Illegal length
        at org.apache.poi.util.StringUtil.getFromUnicodeHigh(StringUtil.java:112
)
        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)
        ... 13 more
org.apache.poi.hssf.record.RecordFormatException: Unable to construct record ins
tance, the following exception occured: null
        at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.j
ava:265)
        at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.
java:190)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:1
81)
        at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:1
53)
        at gov.moh.ohfs.submission.SPSubmissionForm.init(SPSubmissionForm.java:1
05)
        at gov.moh.ohfs.submission.SPSubmission.importSPData(SPSubmission.java:2
52)
        at gov.moh.ohfs.submission.SPSubmission.process(SPSubmission.java:192)
        at gov.moh.ohfs.report.generation.ReportGenController.processFacility(Re
portGenController.java:387)
        at gov.moh.ohfs.report.generation.ReportGenController.main(ReportGenCont
roller.java:621)
Comment 1 Andy Oliver 2003-03-12 16:26:26 UTC
http://jakarta.apache.org/poi/faq.html#faq-5