Bug 60226 - ClassLoader workaround for OSGI when processing OOXML files
Summary: ClassLoader workaround for OSGI when processing OOXML files
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: 3.16-dev
Hardware: All All
: P2 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-08 17:03 UTC by Andreas Beeker
Modified: 2016-10-08 17:10 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.