https://bz.apache.org/bugzilla/show_bug.cgi?id=66176

--- Comment #2 from PJ Fanning <[email protected]> ---
This change causes poi-integration tests to fail - I'll temporarily change
poi-integration tests to not process the smartart-simple.pptx.

The issue is in this code in XSLFDiagram (added by this patch):

        if (hasBlipEmbed(msShapeCt)) {
            String embedId =
msShapeCt.getSpPr().getBlipFill().getBlip().getEmbed();
            POIXMLDocumentPart part = _drawing.getRelationById(embedId);
            if (part != null) {
                // When reading the blip, POI looks into the `slide#.xml.rels`
file. However, the blip relationship is
                // defined inside `drawing#.xml.rels`. Copy this relationship
to the parent.
                POIXMLDocumentPart.RelationPart updatedRelation =
sheet.addRelation(null, XSLFRelation.IMAGES, part);
               
shapeCt.getSpPr().getBlipFill().getBlip().setEmbed(updatedRelation.getRelationship().getId());
            }
        }


You can't call sheet.addRelation if the document is opened in read-only mode.

Caused by: org.apache.poi.openxml4j.exceptions.InvalidOperationException:
Operation not allowed, document open in read only mode!
        at
org.apache.poi.openxml4j.opc.OPCPackage.throwExceptionIfReadOnly(OPCPackage.java:573)
        at
org.apache.poi.openxml4j.opc.PackagePart.addRelationship(PackagePart.java:250)
        at
org.apache.poi.ooxml.POIXMLDocumentPart.addRelation(POIXMLDocumentPart.java:310)
        at
org.apache.poi.xslf.usermodel.XSLFDiagram.convertShape(XSLFDiagram.java:161)
        at
org.apache.poi.xslf.usermodel.XSLFDiagram.convertMsGroupToGroupShape(XSLFDiagram.java:230)
        at
org.apache.poi.xslf.usermodel.XSLFDiagram.initGroupShape(XSLFDiagram.java:208)
        at
org.apache.poi.xslf.usermodel.XSLFDiagram.<init>(XSLFDiagram.java:82)
        at
org.apache.poi.xslf.usermodel.XSLFGraphicFrame.create(XSLFGraphicFrame.java:103)
        at
org.apache.poi.xslf.usermodel.XSLFSheet.buildShapes(XSLFSheet.java:157)
        at
org.apache.poi.xslf.usermodel.XSLFSheet.initDrawingAndShapes(XSLFSheet.java:218)
        at
org.apache.poi.xslf.usermodel.XSLFSheet.getShapes(XSLFSheet.java:202)
        at
org.apache.poi.xslf.usermodel.XSLFSheet.initPlaceholders(XSLFSheet.java:560)
        at
org.apache.poi.xslf.usermodel.XSLFSheet.getPlaceholderByType(XSLFSheet.java:585)
        at
org.apache.poi.xslf.usermodel.XSLFSheet.getPlaceholder(XSLFSheet.java:538)
        at
org.apache.poi.xslf.usermodel.XSLFSheet.getPlaceholderDetails(XSLFSheet.java:703)
        at
org.apache.poi.xslf.usermodel.XSLFSheet.getPlaceholderDetails(XSLFSheet.java:73)
        at
org.apache.poi.sl.extractor.SlideShowExtractor.addSheetPlaceholderDatails(SlideShowExtractor.java:253)
        at
org.apache.poi.sl.extractor.SlideShowExtractor.printHeaderFooter(SlideShowExtractor.java:216)
        at
org.apache.poi.sl.extractor.SlideShowExtractor.printShapeText(SlideShowExtractor.java:262)
        at
org.apache.poi.sl.extractor.SlideShowExtractor.getText(SlideShowExtractor.java:146)
        at
org.apache.poi.sl.extractor.SlideShowExtractor.getText(SlideShowExtractor.java:131)

Yaseen - could you see if there is another way to get this to work without
calling sheet.addRelation ?

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to