i want to read the ppt/pptx and draw into images here is some test: { BufferedImage img = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB); try { SlideShow ss = SlideShowFactory.create(Init.class.getClassLoader().getResourceAsStream("ppt.ppt")); List<? extends Slide> slide = ss.getSlides(); Graphics2D graphics = img.createGraphics(); slide.get(0).draw(graphics); } catch (Exception e) { e.printStackTrace(); } try { SlideShow ss = SlideShowFactory.create(Init.class.getClassLoader().getResourceAsStream("ppt.pptx")); List<? extends Slide> slide = ss.getSlides(); Graphics2D graphics = img.createGraphics(); slide.get(0).draw(graphics); } catch (Exception e) { e.printStackTrace(); } System.out.println("fin"); } when run this code under oracle or openjdk it's all ok. but when run in websphere, it always brings a RuntimeException like this: java.lang.RuntimeException: java.lang.IllegalStateException: reader must be on a START_ELEMENT event, not a 4 event at org.apache.poi.sl.draw.geom.PresetGeometries.getInstance(PresetGeometries.java:115) at org.apache.poi.hslf.usermodel.HSLFSimpleShape.getGeometry(HSLFSimpleShape.java:341) at org.apache.poi.sl.draw.DrawSimpleShape.computeOutlines(DrawSimpleShape.java:390) at org.apache.poi.sl.draw.DrawSimpleShape.draw(DrawSimpleShape.java:75) at org.apache.poi.sl.draw.DrawSheet.draw(DrawSheet.java:67) at org.apache.poi.sl.draw.DrawSlide.draw(DrawSlide.java:39) at org.apache.poi.hslf.usermodel.HSLFSlide.draw(HSLFSlide.java:467) at ppt.Init.main(Init.java:19) Caused by: java.lang.IllegalStateException: reader must be on a START_ELEMENT event, not a 4 event at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:455) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:433) at org.apache.poi.sl.draw.geom.PresetGeometries.init(PresetGeometries.java:75) at org.apache.poi.sl.draw.geom.PresetGeometries.getInstance(PresetGeometries.java:110) ... 7 more java.lang.RuntimeException: java.lang.IllegalStateException: reader must be on a START_ELEMENT event, not a 4 event at org.apache.poi.sl.draw.geom.PresetGeometries.getInstance(PresetGeometries.java:115) at org.apache.poi.xslf.usermodel.XSLFSimpleShape.getGeometry(XSLFSimpleShape.java:686) at org.apache.poi.sl.draw.DrawSimpleShape.computeOutlines(DrawSimpleShape.java:390) at org.apache.poi.sl.draw.DrawSimpleShape.draw(DrawSimpleShape.java:75) at org.apache.poi.sl.draw.DrawSheet.draw(DrawSheet.java:67) at org.apache.poi.sl.draw.DrawSlide.draw(DrawSlide.java:39) at org.apache.poi.xslf.usermodel.XSLFSlide.draw(XSLFSlide.java:301) at ppt.Init.main(Init.java:27) Caused by: java.lang.IllegalStateException: reader must be on a START_ELEMENT event, not a 4 event at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:455) at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:433) at org.apache.poi.sl.draw.geom.PresetGeometries.init(PresetGeometries.java:75) at org.apache.poi.sl.draw.geom.PresetGeometries.getInstance(PresetGeometries.java:110) ... 7 more fin the ibm jdk version I've test is java version "1.8.0" Java(TM) SE Runtime Environment (build pxa6480sr2fp10ifix-20160223_01(SR2 FP10+IV81318+IV81645+IV81741+IV81716)) IBM J9 VM (build 2.8, JRE 1.8.0 Linux amd64-64 Compressed References 20160210_289934 (JIT enabled, AOT enabled) J9VM - R28_Java8_SR2_20160210_1617_B289934 JIT - tr.r14.java_20151209_107110.04 GC - R28_Java8_SR2_20160210_1617_B289934_CMPRSS J9CL - 20160210_289934) JCL - 20151231_01 based on Oracle jdk8u71-b15 And java version "1.7.0" Java(TM) SE Runtime Environment (build pxa6470sr4fp1ifix-20130423_02(SR4 FP1+IV38579+IV38399+IV40208)) IBM J9 VM (build 2.6, JRE 1.7.0 Linux amd64-64 Compressed References 20130421_145945 (JIT enabled, AOT enabled) J9VM - R26_Java726_SR4_FP1_2_20130421_2353_B145945 JIT - r11.b03_20130131_32403ifx4 GC - R26_Java726_SR4_FP1_2_20130421_2353_B145945_CMPRSS J9CL - 20130422_145945) JCL - 20130225_01 based on Oracle 7u13-b08 Is this a poi bug when use xmlreader to initialize presetShapeDefinitions.xml or a ibm jdk xmlreader bug processing xml element event
If you can load the ppt using one JDK and not another, then I'd suggest that the issue is likely to be in the second JDK. Could you try upgrading your JDK and if IBM JDK continues to be an issue, could you try up to date versions of OpenJDK or Oracle JDK?
(In reply to PJ Fanning from comment #1) > If you can load the ppt using one JDK and not another, then I'd suggest that > the issue is likely to be in the second JDK. > Could you try upgrading your JDK and if IBM JDK continues to be an issue, > could you try up to date versions of OpenJDK or Oracle JDK? I have tried to install up to date ibm jdk,and encountered a RuntimeException as before. ibm jdk version: java version "1.8.0_191" Java(TM) SE Runtime Environment (build 8.0.5.26 - pxa6480sr5fp26-20181115_03(SR5 FP26)) IBM J9 VM (build 2.9, JRE 1.8.0 Linux amd64-64-Bit Compressed References 20181106_401576 (JIT enabled, AOT enabled) OpenJ9 - fde1d6f OMR - d8c3617 IBM - 5c4a9f0) JCL - 20181022_01 based on Oracle jdk8u191-b26 while newest OpenJDK and OracleJDK works fine perhaps I have to configure websphere to use openjdk or oraclejdk. Thank you
Maybe you should report this JAXB issue to IBM.
(In reply to PJ Fanning from comment #3) > Maybe you should report this JAXB issue to IBM. yes,I have make my effort to find how to report this issue to IBM, but the official forum always went wrong. It response 400 bad request with follow message : Yikes — we didn't catch all of that. Something went wrong someplace. I'll try again some time later
fixed via r1848494 see also https://stackoverflow.com/questions/28860131/illegalstateexception-when-unmarshalling-from-child-node-with-xmleventreader Currently the IBM build isn't successful, as there is an encryption bug ... but I'm on it
(In reply to Andreas Beeker from comment #5) > fixed via r1848494 > > see also > https://stackoverflow.com/questions/28860131/illegalstateexception-when- > unmarshalling-from-child-node-with-xmleventreader > > Currently the IBM build isn't successful, as there is an encryption bug ... > but I'm on it Yes, it works!~~Thanks very much But it still makes me confused why the event filterReader failed. The answer from stackoverflow tells "when you pass it to the Unmarshaller it is going to ask for the next event",doesn't it means the reader "cursor" is at the position of, for example: <accentBorderCallout1> ↑here and the unmarsheller call of next will return a START_ELEMENT? I think it has the same meaning of the documentation of what filterRead.peek() say : "A call to peek() will be equal to the next return of next()".