From 3cf16f40d25fbba8089db56511a146d385539628 Mon Sep 17 00:00:00 2001 From: Nick Burch Date: Fri, 2 Jul 2010 21:35:06 +0000 Subject: [PATCH] Fix deprecated warnings git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@960115 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/poi/xwpf/model/XWPFCommentsDecorator.java | 2 +- .../poi/xwpf/model/XWPFHeaderFooterPolicy.java | 12 ++++++------ .../poi/xwpf/model/XWPFHyperlinkDecorator.java | 6 +++--- .../org/apache/poi/xwpf/usermodel/XWPFComment.java | 2 +- .../org/apache/poi/xwpf/usermodel/XWPFDocument.java | 8 ++++---- .../org/apache/poi/xwpf/usermodel/XWPFFootnote.java | 2 +- .../apache/poi/xwpf/usermodel/XWPFHeaderFooter.java | 2 +- .../apache/poi/xwpf/usermodel/XWPFLatentStyles.java | 2 +- .../org/apache/poi/xwpf/usermodel/XWPFNumbering.java | 6 +++--- .../org/apache/poi/xwpf/usermodel/XWPFParagraph.java | 12 ++++-------- .../java/org/apache/poi/xwpf/usermodel/XWPFRun.java | 2 +- .../org/apache/poi/xwpf/usermodel/XWPFStyles.java | 4 ++-- .../org/apache/poi/xwpf/usermodel/XWPFTable.java | 6 +++--- .../org/apache/poi/xwpf/usermodel/XWPFTableRow.java | 2 +- 14 files changed, 32 insertions(+), 36 deletions(-) diff --git a/src/ooxml/java/org/apache/poi/xwpf/model/XWPFCommentsDecorator.java b/src/ooxml/java/org/apache/poi/xwpf/model/XWPFCommentsDecorator.java index 0ceb8accb1..7a528237a1 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/model/XWPFCommentsDecorator.java +++ b/src/ooxml/java/org/apache/poi/xwpf/model/XWPFCommentsDecorator.java @@ -39,7 +39,7 @@ public class XWPFCommentsDecorator extends XWPFParagraphDecorator { XWPFComment comment; commentText = new StringBuffer(); - for(CTMarkupRange anchor : paragraph.getCTP().getCommentRangeStartArray()) + for(CTMarkupRange anchor : paragraph.getCTP().getCommentRangeStartList()) { if((comment = paragraph.getDocument().getCommentByID(anchor.getId().toString())) != null) commentText.append("\tComment by " + comment.getAuthor()+": "+comment.getText()); diff --git a/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java b/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java index 7c90a59baa..3316435190 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java +++ b/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHeaderFooterPolicy.java @@ -242,8 +242,8 @@ public class XWPFHeaderFooterPolicy { } else { CTP p = ftr.addNewP(); - byte[] rsidr = doc.getDocument().getBody().getPArray()[0].getRsidR(); - byte[] rsidrdefault = doc.getDocument().getBody().getPArray()[0].getRsidRDefault(); + byte[] rsidr = doc.getDocument().getBody().getPArray(0).getRsidR(); + byte[] rsidrdefault = doc.getDocument().getBody().getPArray(0).getRsidRDefault(); p.setRsidP(rsidr); p.setRsidRDefault(rsidrdefault); CTPPr pPr = p.addNewPPr(); @@ -274,8 +274,8 @@ public class XWPFHeaderFooterPolicy { } else { CTP p = ftr.addNewP(); - byte[] rsidr = doc.getDocument().getBody().getPArray()[0].getRsidR(); - byte[] rsidrdefault = doc.getDocument().getBody().getPArray()[0].getRsidRDefault(); + byte[] rsidr = doc.getDocument().getBody().getPArray(0).getRsidR(); + byte[] rsidrdefault = doc.getDocument().getBody().getPArray(0).getRsidRDefault(); p.setRsidP(rsidr); p.setRsidRDefault(rsidrdefault); CTPPr pPr = p.addNewPPr(); @@ -400,8 +400,8 @@ public class XWPFHeaderFooterPolicy { */ private XWPFParagraph getWatermarkParagraph(String text, int idx) { CTP p = CTP.Factory.newInstance(); - byte[] rsidr = doc.getDocument().getBody().getPArray()[0].getRsidR(); - byte[] rsidrdefault = doc.getDocument().getBody().getPArray()[0].getRsidRDefault(); + byte[] rsidr = doc.getDocument().getBody().getPArray(0).getRsidR(); + byte[] rsidrdefault = doc.getDocument().getBody().getPArray(0).getRsidRDefault(); p.setRsidP(rsidr); p.setRsidRDefault(rsidrdefault); CTPPr pPr = p.addNewPPr(); diff --git a/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHyperlinkDecorator.java b/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHyperlinkDecorator.java index 4be1e302bc..3ad4c492d3 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHyperlinkDecorator.java +++ b/src/ooxml/java/org/apache/poi/xwpf/model/XWPFHyperlinkDecorator.java @@ -49,10 +49,10 @@ public class XWPFHyperlinkDecorator extends XWPFParagraphDecorator { hyperlinkText = new StringBuffer(); // loop over hyperlink anchors - for(CTHyperlink link : paragraph.getCTP().getHyperlinkArray()){ - for (CTR r : link.getRArray()) { + for(CTHyperlink link : paragraph.getCTP().getHyperlinkList()){ + for (CTR r : link.getRList()) { // Loop over text runs - for (CTText text : r.getTArray()){ + for (CTText text : r.getTList()){ hyperlinkText.append(text.getStringValue()); } } diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFComment.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFComment.java index 72596085d3..1f8e799fc2 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFComment.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFComment.java @@ -37,7 +37,7 @@ public class XWPFComment id = comment.getId().toString(); author = comment.getAuthor(); - for(CTP ctp : comment.getPArray()) + for(CTP ctp : comment.getPList()) { XWPFParagraph p = new XWPFParagraph(ctp, null); text.append(p.getText()); diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java index a7adc3356f..9f1acbbea7 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java @@ -179,7 +179,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody { else if(relation.equals(XWPFRelation.COMMENT.getRelation())){ CommentsDocument cmntdoc = CommentsDocument.Factory.parse(p.getPackagePart().getInputStream()); - for(CTComment ctcomment : cmntdoc.getComments().getCommentArray()) { + for(CTComment ctcomment : cmntdoc.getComments().getCommentList()) { comments.add(new XWPFComment(ctcomment)); } } @@ -217,13 +217,13 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody { if(relation.equals(XWPFRelation.FOOTNOTE.getRelation())){ FootnotesDocument footnotesDocument = FootnotesDocument.Factory.parse(p.getPackagePart().getInputStream()); - for(CTFtnEdn ctFtnEdn : footnotesDocument.getFootnotes().getFootnoteArray()) { + for(CTFtnEdn ctFtnEdn : footnotesDocument.getFootnotes().getFootnoteList()) { footnotes.put(ctFtnEdn.getId().intValue(), new XWPFFootnote(this, ctFtnEdn)); } } else if (relation.equals(XWPFRelation.ENDNOTE.getRelation())){ EndnotesDocument endnotesDocument = EndnotesDocument.Factory.parse(p.getPackagePart().getInputStream()); - for(CTFtnEdn ctFtnEdn : endnotesDocument.getEndnotes().getEndnoteArray()) { + for(CTFtnEdn ctFtnEdn : endnotesDocument.getEndnotes().getEndnoteList()) { endnotes.put(ctFtnEdn.getId().intValue(), new XWPFFootnote(this, ctFtnEdn)); } } @@ -944,7 +944,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody { public void insertTable(int pos, XWPFTable table) { bodyElements.add(pos, table); int i; - for (i = 0; i < ctDocument.getBody().getTblArray().length; i++) { + for (i = 0; i < ctDocument.getBody().getTblList().size(); i++) { CTTbl tbl = ctDocument.getBody().getTblArray(i); if(tbl == table.getCTTbl()){ break; diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFFootnote.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFFootnote.java index b3e30b8e0f..e52e4fc0ab 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFFootnote.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFFootnote.java @@ -27,7 +27,7 @@ public class XWPFFootnote implements Iterable { private List paragraphs = new ArrayList(); public XWPFFootnote(XWPFDocument document, CTFtnEdn body) { - for (CTP p : body.getPArray()) { + for (CTP p : body.getPList()) { paragraphs.add(new XWPFParagraph(p, document)); } } diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java index af870718eb..fe24efcd34 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFHeaderFooter.java @@ -457,7 +457,7 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo public void insertTable(int pos, XWPFTable table) { bodyElements.add(pos, table); int i; - for (i = 0; i < headerFooter.getTblArray().length; i++) { + for (i = 0; i < headerFooter.getTblList().size(); i++) { CTTbl tbl = headerFooter.getTblArray(i); if(tbl == table.getCTTbl()){ break; diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFLatentStyles.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFLatentStyles.java index e04dc914f4..a0a586313b 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFLatentStyles.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFLatentStyles.java @@ -39,7 +39,7 @@ public class XWPFLatentStyles { * checks wheter specific LatentStyleID is a latentStyle */ protected boolean isLatentStyle(String latentStyleID){ - for ( CTLsdException lsd: latentStyles.getLsdExceptionArray()) { + for ( CTLsdException lsd: latentStyles.getLsdExceptionList()) { if(lsd.getName().equals(latentStyleID)); return true; } diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFNumbering.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFNumbering.java index 267491ff9e..9bf7f1b33d 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFNumbering.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFNumbering.java @@ -72,10 +72,10 @@ public class XWPFNumbering extends POIXMLDocumentPart { numberingDoc = NumberingDocument.Factory.parse(is); ctNumbering = numberingDoc.getNumbering(); //get any Nums - for(CTNum ctNum : ctNumbering.getNumArray()) { + for(CTNum ctNum : ctNumbering.getNumList()) { nums.add(new XWPFNum(ctNum, this)); } - for(CTAbstractNum ctAbstractNum : ctNumbering.getAbstractNumArray()){ + for(CTAbstractNum ctAbstractNum : ctNumbering.getAbstractNumList()){ abstractNums.add(new XWPFAbstractNum(ctAbstractNum, this)); } isNew = false; @@ -129,7 +129,7 @@ public class XWPFNumbering extends POIXMLDocumentPart { */ public BigInteger addNum(XWPFNum num){ ctNumbering.addNewNum(); - int pos = (ctNumbering.getNumArray().length) - 1; + int pos = (ctNumbering.getNumList().size()) - 1; ctNumbering.setNumArray(pos, num.getCTNum()); nums.add(num); return num.getCTNum().getNumId(); diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java index e0741e782a..fed5b097d8 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFParagraph.java @@ -18,12 +18,9 @@ package org.apache.poi.xwpf.usermodel; import java.math.BigInteger; import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; import java.util.Collections; import java.util.List; -import org.apache.poi.POIXMLDocumentPart; import org.apache.poi.util.Internal; import org.apache.xmlbeans.XmlCursor; import org.apache.xmlbeans.XmlObject; @@ -46,7 +43,6 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSdtContentRun; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSdtRun; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTSpacing; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTString; -import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTbl; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTText; import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTextAlignment; import org.openxmlformats.schemas.wordprocessingml.x2006.main.STBorder; @@ -1139,10 +1135,10 @@ public class XWPFParagraph implements IBodyElement{ */ protected void addRun(CTR run){ int pos; - pos = paragraph.getRArray().length; + pos = paragraph.getRList().size(); paragraph.addNewR(); paragraph.setRArray(pos, run); - for (CTText ctText: paragraph.getRArray(pos).getTArray()) { + for (CTText ctText: paragraph.getRArray(pos).getTList()) { this.text.append(ctText.getStringValue()); } } @@ -1162,7 +1158,7 @@ public class XWPFParagraph implements IBodyElement{ startChar = startPos.getChar(); int beginRunPos = 0, candCharPos = 0; boolean newList = false; - for (int runPos=startRun; runPos 0) { rowText.append('\t'); diff --git a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableRow.java b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableRow.java index 4ac301476f..01996dc49e 100644 --- a/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableRow.java +++ b/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFTableRow.java @@ -127,7 +127,7 @@ public class XWPFTableRow { public List getTableCells(){ if(tableCells == null){ List cells = new ArrayList(); - for (CTTc tableCell : ctRow.getTcArray()) { + for (CTTc tableCell : ctRow.getTcList()) { cells.add(new XWPFTableCell(tableCell, this, table.getPart())); } this.tableCells = cells; -- 2.39.5