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

(-)src/java/org/apache/poi/util/Units.java (-1 / +10 lines)
Lines 26-36 Link Here
26
    /**
26
    /**
27
     * Converts points to EMUs
27
     * Converts points to EMUs
28
     * @param points points
28
     * @param points points
29
     * @return emus
29
     * @return EMUs
30
     */
30
     */
31
    public static int toEMU(double points){
31
    public static int toEMU(double points){
32
        return (int)Math.round(EMU_PER_POINT*points);
32
        return (int)Math.round(EMU_PER_POINT*points);
33
    }
33
    }
34
    
35
    /**
36
     * Converts pixels to EMUs
37
     * @param pixels pixels
38
     * @return EMUs
39
     */
40
    public static int pixelToEMU(int pixels) {
41
        return pixels*EMU_PER_PIXEL;
42
    }
34
43
35
    /**
44
    /**
36
     * Converts EMUs to points
45
     * Converts EMUs to points
(-)src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java (-3 / +9 lines)
Lines 330-336 Link Here
330
     */
330
     */
331
    @Override
331
    @Override
332
    public XWPFTable getTableArray(int pos) {
332
    public XWPFTable getTableArray(int pos) {
333
        if (pos > 0 && pos < tables.size()){
333
        if (pos >= 0 && pos < tables.size()){
334
            return tables.get(pos);
334
            return tables.get(pos);
335
        }
335
        }
336
        return null;
336
        return null;
Lines 345-351 Link Here
345
    }
345
    }
346
346
347
    public XWPFFooter getFooterArray(int pos){
347
    public XWPFFooter getFooterArray(int pos){
348
        return footers.get(pos);
348
        if(pos >=0 && pos < footers.size()) {
349
            return footers.get(pos);
350
        }
351
        return null;
349
    }
352
    }
350
353
351
    /**
354
    /**
Lines 357-363 Link Here
357
    }
360
    }
358
361
359
    public XWPFHeader getHeaderArray(int pos){
362
    public XWPFHeader getHeaderArray(int pos){
360
        return headers.get(pos);
363
        if(pos >=0 && pos < headers.size()) {
364
            return headers.get(pos);
365
        }
366
        return null;
361
    }
367
    }
362
368
363
    public String getTblStyle(XWPFTable table){
369
    public String getTblStyle(XWPFTable table){
(-)src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFFootnote.java (-4 / +6 lines)
Lines 111-117 Link Here
111
     * @see org.apache.poi.xwpf.usermodel.IBody#getTableArray(int)
111
     * @see org.apache.poi.xwpf.usermodel.IBody#getTableArray(int)
112
     */
112
     */
113
    public XWPFTable getTableArray(int pos) {
113
    public XWPFTable getTableArray(int pos) {
114
        if(pos > 0 && pos < tables.size()){
114
        if(pos >= 0 && pos < tables.size()){
115
            return tables.get(pos);
115
            return tables.get(pos);
116
        }
116
        }
117
        return null;
117
        return null;
Lines 177-184 Link Here
177
     * @see org.apache.poi.xwpf.usermodel.IBody#getParagraphArray(int pos)
177
     * @see org.apache.poi.xwpf.usermodel.IBody#getParagraphArray(int pos)
178
     */
178
     */
179
    public XWPFParagraph getParagraphArray(int pos) {
179
    public XWPFParagraph getParagraphArray(int pos) {
180
180
        if(pos >=0 && pos < paragraphs.size()) {
181
        return paragraphs.get(pos);
181
            return paragraphs.get(pos);
182
        }
183
        return null;
182
    }
184
    }
183
185
184
    /**
186
    /**
Lines 206-212 Link Here
206
            return null;
208
            return null;
207
        }
209
        }
208
        XWPFTableRow tableRow = table.getRow(row);
210
        XWPFTableRow tableRow = table.getRow(row);
209
        if(row == null){
211
        if(tableRow == null){
210
            return null;
212
            return null;
211
        }
213
        }
212
        return tableRow.getTableCell(cell);
214
        return tableRow.getTableCell(cell);
(-)src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java (-3 / +5 lines)
Lines 203-210 Link Here
203
     *  the text of the header or footer.
203
     *  the text of the header or footer.
204
     */
204
     */
205
    public XWPFParagraph getParagraphArray(int pos) {
205
    public XWPFParagraph getParagraphArray(int pos) {
206
206
        if(pos >= 0 && pos<paragraphs.size()){
207
        return paragraphs.get(pos);
207
            return paragraphs.get(pos);
208
        }
209
        return null;
208
    }
210
    }
209
211
210
    /**
212
    /**
Lines 425-431 Link Here
425
     */
427
     */
426
    public XWPFTable getTableArray(int pos) {
428
    public XWPFTable getTableArray(int pos) {
427
429
428
        if(pos > 0 && pos < tables.size()){
430
        if(pos >= 0 && pos < tables.size()){
429
            return tables.get(pos);
431
            return tables.get(pos);
430
        }
432
        }
431
        return null;
433
        return null;
(-)src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableCell.java (-2 / +2 lines)
Lines 340-346 Link Here
340
     * @see org.apache.poi.xwpf.usermodel.IBody#getParagraphArray(int)
340
     * @see org.apache.poi.xwpf.usermodel.IBody#getParagraphArray(int)
341
     */
341
     */
342
    public XWPFParagraph getParagraphArray(int pos) {
342
    public XWPFParagraph getParagraphArray(int pos) {
343
	if(pos > 0 && pos < paragraphs.size()){
343
	if(pos >= 0 && pos < paragraphs.size()){
344
	    return paragraphs.get(pos);
344
	    return paragraphs.get(pos);
345
	}
345
	}
346
	return null;
346
	return null;
Lines 379-385 Link Here
379
     * @see org.apache.poi.xwpf.usermodel.IBody#getTableArray(int)
379
     * @see org.apache.poi.xwpf.usermodel.IBody#getTableArray(int)
380
     */
380
     */
381
    public XWPFTable getTableArray(int pos) {
381
    public XWPFTable getTableArray(int pos) {
382
	if(pos > 0 && pos < tables.size()){
382
	if(pos >= 0 && pos < tables.size()){
383
	    return tables.get(pos);
383
	    return tables.get(pos);
384
	}
384
	}
385
	return null;
385
	return null;

Return to bug 57495