Hi,
This isn’t a repeat of my previous post; they’re two separate issues. Attached are two presentations that are saved in PowerPoint 2000. When I clone the single slide from either into a fresh presentation I get an IndexOutOfBoundsException, although the index quoted in the exception differs depending on the presence of a master slide.
The presentations originated from a third party designer whose details I don’t have access to, but there’s something about the files that Aspose doesn’t like. The exceptions occur during Presentation.write (the cloneSlide call completes properly), and stacks are below the code.
I’m running the Diablo 1.6 VM on FreeBSD 7.1, with Aspose Slides 1.9. I can’t test it with Aspose 2.3.0 because it crashes during cloneSlide on all the inputs I’ve tried (as per <a href="IndexOutOfBoundsException cloning slide with master slide).
Steve
Code
import com.aspose.slides.*;
import java.io.*;
import java.util.TreeMap;
class PptTestCase {
static public void main(String[] args) {
try
{
String templateFile = args[0];
String outFile = “aspose_” + templateFile;
FileInputStream is = new FileInputStream(templateFile);
Presentation srcPres=new Presentation(is);
is.close();
Slide templateSlide = srcPres.getSlideByPosition(1);
Presentation targetPres = new Presentation();
TreeMap tMap = new TreeMap();
int endPosition = targetPres.getSlides().getLastSlidePosition() + 1;
// This throws IndexOutOfBounds
srcPres.cloneSlide(templateSlide, endPosition, targetPres, tMap);
FileOutputStream os = new FileOutputStream(outFile);
targetPres.write(os);
os.close();
}
catch (Exception e){
e.printStackTrace();
}
}
}
Exception - end_template.ppt
java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at com.aspose.slides.PictureBullets.get(SourceFile:34)
at com.aspose.slides.Presentation.do(SourceFile:3227)
at com.aspose.slides.Presentation.do(SourceFile:3347)
at com.aspose.slides.Presentation.if(SourceFile:3598)
at com.aspose.slides.Presentation.write(SourceFile:596)
at PptTestCase.main(PptTestCase.java:24)
Exception - end_template_no_master.ppt
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:547)
at java.util.ArrayList.get(ArrayList.java:322)
at com.aspose.slides.PictureBullets.get(SourceFile:34)
at com.aspose.slides.Presentation.do(SourceFile:3227)
at com.aspose.slides.Presentation.do(SourceFile:3347)
at com.aspose.slides.Presentation.if(SourceFile:3598)
at com.aspose.slides.Presentation.write(SourceFile:596)
at PptTestCase.main(PptTestCase.java:24)