Bug 65291

Summary: XWPFRun method getStyle() throws an ArrayOutOfBoundsException
Product: POI Reporter: Mark Glass <mark.glass>
Component: XWPFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 5.0.0-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   

Description Mark Glass 2021-05-06 18:24:25 UTC
The problem is in the 'public String getStyle()' method. The line 'CTString style = pr.getRStyleArray(0)' produces the exception. It would be better to test with 
if (pr.getRStyleArray().length == 0) {
   return "";
}

CTString style = pr.getRStyleArray(0);
if (style == null ) {
   return "";
} else {
   return style;
}

I'm assuming that pr.getRStyleArray(0) can return null.
Comment 1 Sayi 2021-05-07 02:03:18 UTC
Thanks Mark Glass, this has fixed via r1889259 a few days ago, should be included in the upcoming Apache POI 5.0.1.