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
1 changed files with 6 additions and 3 deletions

View File

@ -426,6 +426,8 @@ public class XSSFReader {
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
public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
if (localName.equalsIgnoreCase(SHEET)) {
@ -438,9 +440,10 @@ public class XSSFReader {
} else if (attrName.equalsIgnoreCase(ID)) {
id = attrs.getValue(i);
}
}
if (name != null && id != null) {
sheetRefs.add(new XSSFSheetRef(id, name));
if (name != null && id != null) {
sheetRefs.add(new XSSFSheetRef(id, name));
break;
}
}
}
}