Bug 60226

Summary: ClassLoader workaround for OSGI when processing OOXML files
Product: POI Reporter: Andreas Beeker <kiwiwings>
Component: POI OverallAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 3.16-dev   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Andreas Beeker 2016-10-08 17:03:29 UTC
When using OSGI, the (current thread) context classloader might not see the xmlbeans definition files (*.xsb), which results in either loading errors or undefined behavior (e.g. the written file doesn't contain xml elements).

To workaround this, the new method POIXMLTypeLoader.setClassLoader needs to be called before OOXML files are processed - and it's good style to null it, after the calling code/thread is exiting.

Beside this patch, there will be a new servicemix patch in #57857 which still needs to be adapted when POI 3.16 is out.

This has been tested and validated in Apache Felix/Sling.
Comment 1 Andreas Beeker 2016-10-08 17:10:59 UTC
Patch applied via r1763922

Thanks to Guillaume Lucazeau for testing.