Bug 63818

Summary: Allow multiple charsets for same font typeface
Product: POI Reporter: 蒋勇兵 <253684597>
Component: HSLFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 4.0.0-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description 蒋勇兵 2019-10-09 03:17:04 UTC
I tried converting ppt to image in HSLF.
I created a HSLFSlide,then initialized a Graphics2D object,When I call HSLFSlide's draw(Graphics2D) method, appear NullPointerException,like this:
Exception in thread "main" java.lang.NullPointerException
	at org.apache.poi.hslf.usermodel.HSLFTextParagraph.getBulletFont(HSLFTextParagraph.java:683)
	at org.apache.poi.hslf.usermodel.HSLFTextParagraph$1.getBulletFont(HSLFTextParagraph.java:495)
	at org.apache.poi.sl.draw.DrawTextParagraph.getBullet(DrawTextParagraph.java:354)
	at org.apache.poi.sl.draw.DrawTextParagraph.draw(DrawTextParagraph.java:169)
	at org.apache.poi.sl.draw.DrawTextShape.drawParagraphs(DrawTextShape.java:178)
	at org.apache.poi.sl.draw.DrawTextShape.drawContent(DrawTextShape.java:127)
	at org.apache.poi.sl.draw.DrawSimpleShape.draw(DrawSimpleShape.java:103)
	at org.apache.poi.sl.draw.DrawSheet.draw(DrawSheet.java:71)
	at org.apache.poi.sl.draw.DrawSlide.draw(DrawSlide.java:41)
	at org.apache.poi.hslf.usermodel.HSLFSlide.draw(HSLFSlide.java:474)

POI version is 4.1.0,but when i used POI version 3.15,this exception does not exist
Comment 1 Andreas Beeker 2019-10-09 05:48:53 UTC
Please try the PPTX2PNG utility class to render your .ppt.
If it works, compare it's source code against yours.
If not, please upload your .ppt here.
Comment 2 蒋勇兵 2019-10-09 06:56:52 UTC
I used PPTX2PNG utility class to render my .ppt,this problem still exists,I'm sure this is a little bug due to carelessness.This is the console output:
Processing F:\公司制度\入职培训.ppt
Rendering slide 0
Rendering slide 1
Rendering slide 2
java.lang.NullPointerException
	at org.apache.poi.hslf.usermodel.HSLFTextParagraph.getBulletFont(HSLFTextParagraph.java:683)
	at org.apache.poi.hslf.usermodel.HSLFTextParagraph$1.getBulletFont(HSLFTextParagraph.java:495)
	at org.apache.poi.sl.draw.DrawTextParagraph.getBullet(DrawTextParagraph.java:354)
	at org.apache.poi.sl.draw.DrawTextParagraph.draw(DrawTextParagraph.java:169)
	at org.apache.poi.sl.draw.DrawTextShape.drawParagraphs(DrawTextShape.java:178)
	at org.apache.poi.sl.draw.DrawTextShape.drawContent(DrawTextShape.java:127)
	at org.apache.poi.sl.draw.DrawSimpleShape.draw(DrawSimpleShape.java:103)
	at org.apache.poi.sl.draw.DrawSheet.draw(DrawSheet.java:71)
	at org.apache.poi.sl.draw.DrawSlide.draw(DrawSlide.java:41)
	at org.apache.poi.hslf.usermodel.HSLFSlide.draw(HSLFSlide.java:474)
	at org.apache.poi.xslf.util.PPTX2PNG.main(PPTX2PNG.java:154)
	at cn.iter.market.poi.PPTToHtml.main(PPTToHtml.java:257)

Because the PPT is too large, I can't upload it. This is the link https://github.com/jiangyongbing24/poi/raw/master/images/%E5%85%A5%E8%81%8C%E5%9F%B9%E8%AE%AD.ppt. If you download it, I will delete it immediately.
Comment 3 蒋勇兵 2019-10-09 07:41:01 UTC
(In reply to Andreas Beeker from comment #1)
> Please try the PPTX2PNG utility class to render your .ppt.
> If it works, compare it's source code against yours.
> If not, please upload your .ppt here.

I used PPTX2PNG utility class to render my .ppt,this problem still exists,I'm sure this is a little bug due to carelessness.This is the console output:
Processing F:\公司制度\入职培训.ppt
Rendering slide 0
Rendering slide 1
Rendering slide 2
java.lang.NullPointerException
	at org.apache.poi.hslf.usermodel.HSLFTextParagraph.getBulletFont(HSLFTextParagraph.java:683)
	at org.apache.poi.hslf.usermodel.HSLFTextParagraph$1.getBulletFont(HSLFTextParagraph.java:495)
	at org.apache.poi.sl.draw.DrawTextParagraph.getBullet(DrawTextParagraph.java:354)
	at org.apache.poi.sl.draw.DrawTextParagraph.draw(DrawTextParagraph.java:169)
	at org.apache.poi.sl.draw.DrawTextShape.drawParagraphs(DrawTextShape.java:178)
	at org.apache.poi.sl.draw.DrawTextShape.drawContent(DrawTextShape.java:127)
	at org.apache.poi.sl.draw.DrawSimpleShape.draw(DrawSimpleShape.java:103)
	at org.apache.poi.sl.draw.DrawSheet.draw(DrawSheet.java:71)
	at org.apache.poi.sl.draw.DrawSlide.draw(DrawSlide.java:41)
	at org.apache.poi.hslf.usermodel.HSLFSlide.draw(HSLFSlide.java:474)
	at org.apache.poi.xslf.util.PPTX2PNG.main(PPTX2PNG.java:154)
	at cn.iter.market.poi.PPTToHtml.main(PPTToHtml.java:257)

Because the PPT is too large, I can't upload it. This is the link https://github.com/jiangyongbing24/poi/raw/master/images/%E5%85%A5%E8%81%8C%E5%9F%B9%E8%AE%AD.ppt. If you download it, I will delete it immediately.
Comment 4 Andreas Beeker 2019-10-12 18:02:31 UTC
The test file contained multiple WingDings font entries with the same name but with different charsets. This is now handled.
Furthermore I've fixed an endless recursion in determining text properties.
Carelessly ;) applied via r1868358