Bug 42481 - Exception from Slide.getMasterSheet() on a seemingly valid PPT file
Summary: Exception from Slide.getMasterSheet() on a seemingly valid PPT file
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSLF (show other bugs)
Version: 3.0-dev
Hardware: Other other
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL: http://thefdp.org/alterman_security.ppt
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-21 18:40 UTC by Ivan Todoroski
Modified: 2007-05-25 05:08 UTC (History)
0 users



Attachments
copy of the file in case URL disappears (813.50 KB, application/vnd.ms-powerpoint)
2007-05-21 19:51 UTC, Ivan Todoroski
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Todoroski 2007-05-21 18:40:01 UTC
The file at above URL shows two slide masters in PowerPoint, but 
SlideShow.getSlideMasters() only returns one. This causes 
Slide.getMasterSheet() to throw a RuntimeException on the first slide.

Even if the root cause (getSlideMasters()) is not fixed, I think it would be 
better for getMasterSheet() to simply return null if it can't find the master, 
instead of throwing exceptions. As it is, you are forced to try/catch a 
RuntimeException if you want to recover, but catching a RuntimeException is too 
broad, it may mask other exceptions that may come from the API.
Comment 1 Ivan Todoroski 2007-05-21 19:51:29 UTC
Created attachment 20233 [details]
copy of the file in case URL disappears
Comment 2 Yegor Kozlov 2007-05-24 03:52:51 UTC
The first slide should return TitleMaster which is not yet supported. I need to
think a little bit how to fit it in the current design.  

>Even if the root cause (getSlideMasters()) is not fixed, I think it would be 
>better for getMasterSheet() to simply return null if it can't find the master, 
>instead of throwing exceptions. 
I agree, it shouldn't be fatal and return null; 

>As it is, you are forced to try/catch a 
>RuntimeException if you want to recover, but catching a RuntimeException is too 
>broad, it may mask other exceptions that may come from the API.

I'm going to replace  RuntimeException with HSLFException extends
RuntimeException. Should have done it long ago, but as always, I was distracted
by other tasks.  
Comment 3 Yegor Kozlov 2007-05-25 05:08:43 UTC
I added support for Title Masters. 
Now Slide.getMasterSheet() returns not-null MasterSheet object - either
SlideMaster or TitleMaster.

Yegor