Bug 51626 - WorkbookFactory.create from FileInputStream throws java.lang.IllegalStateException
Summary: WorkbookFactory.create from FileInputStream throws java.lang.IllegalStateExce...
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.8-FINAL
Hardware: PC All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2011-08-05 14:47 UTC by Bryan
Modified: 2015-08-23 19:41 UTC (History)
0 users

Small Excel file that causes this issue (11.06 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2011-08-05 14:47 UTC, Bryan
Invalid email hyperlink causes error (10.30 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2012-08-29 21:01 UTC, Alan

Note You need to log in before you can comment on or make changes to this bug.
Description Bryan 2011-08-05 14:47:52 UTC
Created attachment 27355 [details]
Small Excel file that causes this issue

WorkbookFactory.create(fis) throws IllegalStateException when an email hyperlink contains hex C2 A0. 

java.lang.IllegalStateException: The hyperlink for cell O4 references relation rId1, but that didn't exist!

I first encountered this issue with POI 3.6, but tested today with 3.8 beta3. I'm not sure how it was created yet, but MS Excel will create the relationship in xl/worksheets/_rels/sheet1-xml.rels. 

Comment 1 Nick Burch 2011-10-06 23:09:44 UTC
I've just tried opening this file with POI 3.8 beta 4, and it didn't have any problems, so it looks like it's been fixed as part of a different bug.
Comment 2 Alan 2012-08-29 21:01:02 UTC
Created attachment 29301 [details]
Invalid email hyperlink causes error
Comment 3 Alan 2012-08-29 21:28:31 UTC
I have run into this issue as well even using the most up to date apache POI 3.8 as of today, 08/29/2012.

I get the error 
"java.lang.IllegalStateException: The hyperlink for cell C5 references relation rId2, but that didn't exist!" when using the excel file I attached. The invalid cell is C5 as noted in the error, and it seems like the WorkbookFactory.create method in POI errors out when validating or parsing an invalid email hyperlink.

I also was able to reproduce it using Bryan's excel file with the invalid blank character after the .uk in cell O4.

-- Alan
Comment 4 Dominik Stadler 2015-08-23 19:41:25 UTC
I could not reproduce this with any of the two files with the latest version 3.13-dev, please try this with a recent nightly build or 3.13-beta1 and reopen this bug if it still happens