Bug 52716 - Hyperlink parser is overly strict causing document open to fail for doc which works in other tools
Hyperlink parser is overly strict causing document open to fail for doc which...
Status: RESOLVED FIXED
Product: POI
Classification: Unclassified
Component: XSSF
3.7
All All
: P2 normal (vote)
: ---
Assigned To: POI Developers List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2012-02-20 18:38 UTC by Tom Morris
Modified: 2012-03-08 05:12 UTC (History)
0 users



Attachments
Failing document (13.68 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2012-02-20 18:38 UTC, Tom Morris
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Morris 2012-02-20 18:38:29 UTC
Created attachment 28357 [details]
Failing document

The attached document fails to open in POI 3.7.  From a cursory look in the debugger where the IllegalStateException is being thrown, it looks to me like this can be safely ignored since it's an unused reference.  (As an aside, it would be much more polite to your callers to use a checked exception so they'd know it was coming and be able to handle it.)

The stack trace is:

java.lang.IllegalStateException: A sheet hyperlink must either have a location, or a relationship. Found:
<xml-fragment ref="A1" tooltip="Sort on ID" display="ID" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"/>
	at org.apache.poi.xssf.usermodel.XSSFHyperlink.<init>(XSSFHyperlink.java:72)
	at org.apache.poi.xssf.usermodel.XSSFSheet.initHyperlinks(XSSFSheet.java:205)
	at org.apache.poi.xssf.usermodel.XSSFSheet.read(XSSFSheet.java:159)
	at org.apache.poi.xssf.usermodel.XSSFSheet.onDocumentRead(XSSFSheet.java:134)
	at org.apache.poi.xssf.usermodel.XSSFWorkbook.onDocumentRead(XSSFWorkbook.java:235)
	at org.apache.poi.POIXMLDocument.load(POIXMLDocument.java:190)
	at org.apache.poi.xssf.usermodel.XSSFWorkbook.<init>(XSSFWorkbook.java:189)
Comment 1 Nick Burch 2012-02-20 18:41:53 UTC
Have you tried with POI 3.8 beta 5?
Comment 2 Tom Morris 2012-02-21 04:39:55 UTC
The behavior is the same with 3.8b5.  It doesn't look like the code has changed at all in this area.  Which bug fix did you think was in beta 5 that would improve this?
Comment 3 Tom Morris 2012-02-21 19:45:09 UTC
The user who provided the file reports that it was created in the following manner: 

"The file was created by dumping an mSQL database (by Hughes) to an HTML page using a simple table. The HTML table was dragged and dropped to Excel 2010."
Comment 4 Yegor Kozlov 2012-02-22 14:15:25 UTC
Should be fixed in r1292295, junit added.

>  (As an aside, it
> would be much more polite to your callers to use a checked exception so they'd
> know it was coming and be able to handle it.)
> 

The only checked exception that can be thrown when constructing XSSFWorkbook is IOException but it is not the case. So we stay with IllegalStateException.

Yegor
Comment 5 Tom Morris 2012-03-07 23:35:03 UTC
Thanks for the quick fix.  I verified the fix in SVN and it works great.

Is there a projected date when 3.8 will be released?  I looked at the web site and checked the dev list mail archive and wasn't able to figure out what the schedule is.

Thanks again!
Comment 6 Yegor Kozlov 2012-03-08 05:12:38 UTC
> 
> Is there a projected date when 3.8 will be released?  I looked at the web site
> and checked the dev list mail archive and wasn't able to figure out what the
> schedule is.
> 

I was planning to roll 3.8-beta6 in March and then release 3.8-final sometime in mid or late April, but there is a good chance we will skip beta6 and release 3.8-final within a month. 

Stay on poi-dev, the release date will be discussed.


Yegor