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

(-)a/src/ooxml/java/org/apache/poi/xslf/usermodel/XSLFShape.java (-1 / +2 lines)
Lines 99-105 public abstract class XSLFShape implements Shape<XSLFShape,XSLFTextParagraph> { Link Here
99
99
100
    @Override
100
    @Override
101
    public String getShapeName(){
101
    public String getShapeName(){
102
        return getCNvPr().getName();
102
        CTNonVisualDrawingProps nonVisualDrawingProps = getCNvPr();
103
        return nonVisualDrawingProps == null ? null : getCNvPr().getName();
103
    }
104
    }
104
105
105
    @Override
106
    @Override
(-)a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFTableRow.java (+19 lines)
Lines 19-24 package org.apache.poi.xslf.usermodel; Link Here
19
import static org.junit.Assert.assertEquals;
19
import static org.junit.Assert.assertEquals;
20
import static org.junit.Assert.assertFalse;
20
import static org.junit.Assert.assertFalse;
21
import static org.junit.Assert.assertNotNull;
21
import static org.junit.Assert.assertNotNull;
22
import static org.junit.Assert.assertNull;
22
import static org.junit.Assert.assertSame;
23
import static org.junit.Assert.assertSame;
23
import static org.junit.Assert.assertTrue;
24
import static org.junit.Assert.assertTrue;
24
import static org.junit.Assert.fail;
25
import static org.junit.Assert.fail;
Lines 128-131 public class TestXSLFTableRow { Link Here
128
        assertNotNull(ctrow);
129
        assertNotNull(ctrow);
129
    }
130
    }
130
131
132
    @Test
133
    public void getShapeNameOfCells() throws Exception {
134
        try(XMLSlideShow ss1 = XSLFTestDataSamples.openSampleDocument("table_test.pptx")) {
135
            for (XSLFSlide slide : ss1.getSlides()) {
136
                for (XSLFShape shape : slide.getShapes()) {
137
                    shape.getShapeName();
138
                    if (shape instanceof XSLFTable) {
139
                        for (XSLFTableRow row : ((XSLFTable) shape).getRows()) {
140
                            for (XSLFTableCell cell : row.getCells()) {
141
                                assertNull(cell.getShapeName()); // Do not throw NPE
142
                            }
143
                        }
144
                    }
145
                }
146
            }
147
        }
148
    }
149
131
}
150
}

Return to bug 63498