DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUGĀ· RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=39096>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED ANDĀ· INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=39096 Summary: bug: adding new slides fails Product: POI Version: unspecified Platform: Other OS/Version: other Status: NEW Severity: normal Priority: P2 Component: HSLF AssignedTo: poi-dev@jakarta.apache.org ReportedBy: [EMAIL PROTECTED] Nick, Something is wrong with adding new slides. Operation works only if you add the first slide to an empty presentation. I attached the test cases. (1) This is the only case when it works. public void testAddSlides1() throws Exception { SlideShow ppt = new SlideShow(); assertTrue(ppt.getSlides().length == 0); ppt.createSlide(); assertTrue(ppt.getSlides().length == 1); //serialize and read again ByteArrayOutputStream out = new ByteArrayOutputStream(); ppt.write(out); out.close(); ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray()))); assertTrue(ppt.getSlides().length == 1); } (2) The same as above but add 2 slides. The ppt is silently serialized but if you open it looks corrupted. Also number of slides is wrong. public void testAddSlides2() throws Exception { SlideShow ppt = new SlideShow(new HSLFSlideShow(dirname + "/empty.ppt")); assertTrue(ppt.getSlides().length == 0); ppt.createSlide(); assertTrue(ppt.getSlides().length == 1); ppt.createSlide(); assertTrue(ppt.getSlides().length == 2); //serialize and read again ByteArrayOutputStream out = new ByteArrayOutputStream(); ppt.write(out); out.close(); ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray()))); assertTrue(ppt.getSlides().length == 2); } (3) Adding slides to a ppt fails on serialization. Any tricks with PersistPtrHolder required? public void testAddSlides3() throws Exception { SlideShow ppt = new SlideShow(new HSLFSlideShow(dirname + "/basic_test_ppt_file.ppt")); assertTrue(ppt.getSlides().length == 2); ppt.createSlide(); assertTrue(ppt.getSlides().length == 3); //serialize and read again ByteArrayOutputStream out = new ByteArrayOutputStream(); ppt.write(out); out.close(); ppt = new SlideShow(new HSLFSlideShow(new ByteArrayInputStream(out.toByteArray()))); assertTrue(ppt.getSlides().length == 3); } Regards, Yegor -- Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta POI Project: http://jakarta.apache.org/poi/