Hi,
I have a powerpoint template file (.potx) in which I have a few slides. In my code I am trying to generate a PPT by cloning slides from the .potx file and setting values in it. Let’s call the .potx template as sourcePPT and the new PPT that I am trying to create as destinationPPT.
The issue is: the following code works without issues in single threaded mode. But when I have multiple-threads cloning from the source slide it throws the following NPE. I have made sure that my class is thread-safe (there are no class variables that I am using anywhere in the code, its a local method variables, so each thread will have its own copy).
java.lang.NullPointerException
at com.aspose.slides.a9.equals(Unknown Source)
at com.aspose.slides.ae4.equals(Unknown Source)
at com.aspose.slides.PVIObject.equals(Unknown Source)
at com.aspose.slides.ae7.do(Unknown Source)
at com.aspose.slides.acu.do(Unknown Source)
at com.aspose.slides.ap3.do(Unknown Source)
at com.aspose.slides.apm.do(Unknown Source)
at com.aspose.slides.apm.do(Unknown Source)
at com.aspose.slides.r.do(Unknown Source)
at com.aspose.slides.rq.do(Unknown Source)
at com.aspose.slides.rq.do(Unknown Source)
at com.aspose.slides.bg.do(Unknown Source)
at com.aspose.slides.vs.do(Unknown Source)
at com.aspose.slides.ald.do(Unknown Source)
at com.aspose.slides.agp.do(Unknown Source)
at com.aspose.slides.agp.do(Unknown Source)
at com.aspose.slides.age.do(Unknown Source)
at com.aspose.slides.MasterSlideCollection.do(Unknown Source)
at com.aspose.slides.MasterSlideCollection.do(Unknown Source)
at com.aspose.slides.SlideCollection.addClone(Unknown Source)
at com.aspose.slides.SlideCollection.insertClone(Unknown Source)
at
code:
Presentation sourcePPT = new
Presentation(ResourceUtil.getResourcePath(DEFAULT_PREBID_IMPS_PPT_TEMPLATE_PATH));
Presentation destinationPPT = new Presentation();
ISlideCollection destinationSlides = destinationPPT.getSlides();
destinationSlides.insertClone(destinationSlides.size(), sourcePPT.getSlides().get_Item(indexOfSourceSlide));
The issue with NPE happens only when multiple threads are running this code (again, as mentioned earlier this code is in a method and no class variables being used, so it is completely thread safe).
Is Aspose thread safe? Am I doing the cloning correctly ?