bug 61034: break out of for-loop when both <sheet name="", id=""/> are found

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1793230 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2017-04-29 18:56:09 +00:00
parent e39ae9cd30
commit f5389965a2

View File

@ -426,6 +426,8 @@ public class XSSFReader {
private final List<XSSFSheetRef> sheetRefs = new LinkedList(); private final List<XSSFSheetRef> sheetRefs = new LinkedList();
// read <sheet name="Sheet6" sheetId="4" r:id="rId6"/>
// and add XSSFSheetRef(id="rId6", name="Sheet6") to sheetRefs
@Override @Override
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException { public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
if (localName.equalsIgnoreCase(SHEET)) { if (localName.equalsIgnoreCase(SHEET)) {
@ -438,9 +440,10 @@ public class XSSFReader {
} else if (attrName.equalsIgnoreCase(ID)) { } else if (attrName.equalsIgnoreCase(ID)) {
id = attrs.getValue(i); id = attrs.getValue(i);
} }
} if (name != null && id != null) {
if (name != null && id != null) { sheetRefs.add(new XSSFSheetRef(id, name));
sheetRefs.add(new XSSFSheetRef(id, name)); break;
}
} }
} }
} }