https://bz.apache.org/bugzilla/show_bug.cgi?id=65673

            Bug ID: 65673
           Summary: XSLFSlide.importContent throw an NPE when source slide
                    contain an image (since 5.1.0)
           Product: POI
           Version: unspecified
          Hardware: PC
            Status: NEW
          Severity: regression
          Priority: P2
         Component: XSLF
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

After switching to POI 5.1.0, XSLFSlide.importContent throw an NPE if source
slide contain an image.

Exception in thread "main" java.lang.NullPointerException
        at java.base/java.util.Objects.requireNonNull(Objects.java:221)
        at
org.apache.commons.io.input.UnsynchronizedByteArrayInputStream.<init>(UnsynchronizedByteArrayInputStream.java:68)
        at
org.apache.poi.openxml4j.util.ZipArchiveFakeEntry.getInputStream(ZipArchiveFakeEntry.java:92)
        at
org.apache.poi.openxml4j.util.ZipInputStreamZipEntrySource.getInputStream(ZipInputStreamZipEntrySource.java:112)
        at
org.apache.poi.openxml4j.opc.ZipPackagePart.getInputStreamImpl(ZipPackagePart.java:106)
        at
org.apache.poi.openxml4j.opc.PackagePart.getInputStream(PackagePart.java:504)
        at
org.apache.poi.xslf.usermodel.XSLFPictureData.getInputStream(XSLFPictureData.java:77)
        at
org.apache.poi.xslf.usermodel.XSLFPictureData.getData(XSLFPictureData.java:89)
        at
org.apache.poi.xslf.usermodel.XSLFSheet.importBlip(XSLFSheet.java:664)
        at
org.apache.poi.xslf.usermodel.XSLFPictureShape.copy(XSLFPictureShape.java:414)
        at
org.apache.poi.xslf.usermodel.XSLFSheet.wipeAndReinitialize(XSLFSheet.java:455)
        at
org.apache.poi.xslf.usermodel.XSLFSheet.importContent(XSLFSheet.java:434)
        at
org.apache.poi.xslf.usermodel.XSLFSlide.importContent(XSLFSlide.java:293)
        at Main.main(Main.java:14)

Working fine on 5.0.0.

Steps to reproduce :
- Create a slide with one image with powerpoint
- Load it with new XMLSlideShow(inputStream)
- Import the first slide into a new XMLSlideShow()
- NPE occurs

I have created a sample project to demontrate the bug :
https://github.com/Halvra/poi-import-slide-with-image

Tell me if you need more details.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to