poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Yegor Kozlov <yegor.koz...@dinom.ru>
Subject Re: classloading xsbs for pptx
Date Wed, 29 Nov 2017 10:49:39 GMT
It seems to be fixed in 3.17. The snippet below fails with 3.16 but works
fine with  3.17 and  trunk

public static void main( String[] args ) throws Exception
{
    Thread thread = Thread.currentThread();
    ClassLoader cl = thread.getContextClassLoader();

    Thread th = new Thread(() -> {
        try {
            XMLSlideShow ppt = new XMLSlideShow(new FileInputStream(args[0]));
            for (XSLFSlide slide : ppt.getSlides()) {
                List<XSLFShape> shapes = slide.getShapes();
            }
        } catch (Exception e){
            e.printStackTrace(); // prints
"java.lang.IllegalStateException: Schemas (*.xsb) for CTTable can't be
loaded " with poi-3.16
        }
    });
    th.setContextClassLoader(cl.getParent());
    th.start();
    th.join();

}

Tim, you should be good to release with poi-3.17, the fix is already there.


Yegor


On Wed, Nov 29, 2017 at 2:25 AM, Andreas Beeker <kiwiwings@apache.org>
wrote:

> Hi Tim,
>
> last time when I've introduced the setClassLoader() method, it was helpful
> to have a minimal maven project
> to showcase the error.
> Can you setup a sample project?
>
> When I changed the ClassLoader code last time with #61478, I've also used
> the same sample project [1]
>
> Andi
>
> [1] https://github.com/glucazeau/test-poi-sling
>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message