View | Details | Raw Unified | Return to bug 62929
Collapse All | Expand All

(-)a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFPictureShape.java (-6 / +15 lines)
Lines 170-185 public class XSLFPictureShape extends XSLFSimpleShape Link Here
170
    
170
    
171
    @SuppressWarnings("WeakerAccess")
171
    @SuppressWarnings("WeakerAccess")
172
    protected String getBlipLink(){
172
    protected String getBlipLink(){
173
        String link = getBlip().getLink();
173
        CTBlip blip = getBlip();
174
        if (link.isEmpty()) return null;
174
        if (blip != null) {
175
        return link;
175
            String link = blip.getLink();
176
            if (link.isEmpty()) return null;
177
        return link;} else {
178
            return null;
179
        }
176
    }
180
    }
177
181
178
    @SuppressWarnings("WeakerAccess")
182
    @SuppressWarnings("WeakerAccess")
179
    protected String getBlipId(){
183
    protected String getBlipId(){
180
        String id = getBlip().getEmbed();
184
        CTBlip blip = getBlip();
181
        if (id.isEmpty()) return null;
185
        if (blip != null) {
182
        return id;
186
            String id = getBlip().getEmbed();
187
            if (id.isEmpty()) return null;
188
            return id;
189
        } else {
190
            return null;
191
        }
183
    }
192
    }
184
193
185
    @Override
194
    @Override
(-)a/src/ooxml/testcases/org/apache/poi/xslf/TestXSLFBugs.java (+22 lines)
Lines 21-26 import static org.junit.Assert.assertArrayEquals; Link Here
21
import static org.junit.Assert.assertEquals;
21
import static org.junit.Assert.assertEquals;
22
import static org.junit.Assert.assertNotNull;
22
import static org.junit.Assert.assertNotNull;
23
import static org.junit.Assert.assertNull;
23
import static org.junit.Assert.assertNull;
24
import static org.junit.Assert.assertFalse;
24
import static org.junit.Assert.assertTrue;
25
import static org.junit.Assert.assertTrue;
25
import static org.junit.Assert.fail;
26
import static org.junit.Assert.fail;
26
27
Lines 93-98 import org.openxmlformats.schemas.presentationml.x2006.main.CTShape; Link Here
93
public class TestXSLFBugs {
94
public class TestXSLFBugs {
94
    private static final POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
95
    private static final POIDataSamples slTests = POIDataSamples.getSlideShowInstance();
95
96
97
    @Test
98
    public void bug62929() throws Exception {
99
        XMLSlideShow ss1 = XSLFTestDataSamples.openSampleDocument("missing-blip-fill.pptx");
100
101
        assertEquals(1, ss1.getSlides().size());
102
103
        XSLFSlide slide = ss1.getSlides().get(0);
104
105
        assertEquals(slide.getShapes().size(), 1);
106
107
        XSLFPictureShape picture = (XSLFPictureShape)slide.getShapes().get(0);
108
109
        assertEquals(picture.getShapeId(), 662);
110
        assertFalse(picture.isExternalLinkedPicture());
111
        assertNull(picture.getPictureData());
112
        assertNull(picture.getPictureLink());
113
        assertNull(picture.getClipping());
114
115
        ss1.close();
116
    }
117
96
    @Test
118
    @Test
97
    public void bug62736() throws Exception {
119
    public void bug62736() throws Exception {
98
        XMLSlideShow ss1 = XSLFTestDataSamples.openSampleDocument("bug62736.pptx");
120
        XMLSlideShow ss1 = XSLFTestDataSamples.openSampleDocument("bug62736.pptx");

Return to bug 62929