NullPointerException Is Thrown when Converting PPTX to ODP in Java

Issue: Unable to convert from PPTX to ODP. Getting the following exception:

Size of loaded PPTX file : 277 kb

Exception in thread "main" java.lang.NullPointerException
        at com.aspose.slides.n7g.ii(Unknown Source)
        at com.aspose.slides.n7g.ii(Unknown Source)
        at com.aspose.slides.n7g.ii(Unknown Source)
        at com.aspose.slides.x8v.ii(Unknown Source)
        at com.aspose.slides.xg.ii(Unknown Source)
        at com.aspose.slides.xg.mh(Unknown Source)
        at com.aspose.slides.in6.ii(Unknown Source)
        at com.aspose.slides.a9q.kp(Unknown Source)
        at com.aspose.slides.a9q.ii(Unknown Source)
        at com.aspose.slides.Presentation.ii(Unknown Source)
        at com.aspose.slides.Presentation.ii(Unknown Source)
        at com.aspose.slides.Presentation.save(Unknown Source)
        at TestODP.main(TestODP.java:30)

Test File to reproduce the issue.



import java.io.*;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

import com.aspose.slides.Presentation;


public class TestODP {

    public static void main(String args[])throws Exception{
        String filename = "final.odp";

        Path path = Paths.get(filename);

        InputStream fileIS = new FileInputStream("./Test.pptx");
        BufferedInputStream bis = new BufferedInputStream(fileIS);
        bis.mark(2147483647);
        long size = getSize(bis);
        bis.reset();
        System.out.println("Size of loaded PPTX file : "+size/1024+" kb\n\n");

        Presentation presentation = null;
        int saveFormat = 6; //ODP
        presentation = new Presentation(bis);
        presentation.save(filename, saveFormat);

        InputStream is = Files.newInputStream(path);
        BufferedInputStream bisODP = new BufferedInputStream(is);

        bisODP.mark(Integer.MAX_VALUE);
        long sizeODP = getSize(bisODP);
        bisODP.reset();


    }
    public static long getSize(InputStream is) {
        long size = 0L;

        try {
            int bufSize = 4096;
            byte[] b = new byte[bufSize];

            for(int read = 1; (read = is.read(b)) >= 0; size += (long)read) {
            }
        } catch (Exception var6) {

        }

        return size;
    }

}

Sample PPTX FIle:
Test.pptx.zip (261.9 KB)
Sample pptx : HERE

@Vaibhaw006,
Thank you for reporting on the issue. I’ve reproduced the error you described.

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): SLIDESJAVA-39329

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Please also share the following additional information if it is possible:

  • OS version on which the conversion was performed
  • JDK version in your app
1 Like

Thanks for the quick response. @andrey.potapov . Feel free to ask if any other info is required.

Aspose slide jar : aspose-slides-23.4-jdk16.jar
JDK : OpenJDK 11.0.20
OS - CentOS 7.3.1611 (but we may use different versions as well. )

@Vaibhaw006,
Thank you for the additional information. I’ve added it to the issue ticket.

The issues you have found earlier (filed as SLIDESJAVA-39329) have been fixed in this update. This message was posted using Bugs notification tool.