You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2017/04/24 22:05:30 UTC
[Bug 61034] New: Call to XSSFReader.getSheetsData() returns
duplicate sheets
https://bz.apache.org/bugzilla/show_bug.cgi?id=61034
Bug ID: 61034
Summary: Call to XSSFReader.getSheetsData() returns duplicate
sheets
Product: POI
Version: 3.16-FINAL
Hardware: PC
OS: Mac OS X 10.1
Status: NEW
Severity: normal
Priority: P2
Component: XSSF
Assignee: dev@poi.apache.org
Reporter: mauricio.eastmond@gmail.com
Target Milestone: ---
Created attachment 34947
--> https://bz.apache.org/bugzilla/attachment.cgi?id=34947&action=edit
use this xlsx file to reproduce the issue.
Call to XSSFReader.getSheetsData() returns duplicate sheets.
The attached xlsx file contains 6 sheets: Sheet1, Sheet2, ..., Sheet6.
The call to XSSFReader.getSheetsData() should return the 6 sheets in the
iterator but it is returning 12 sheets. Each sheet is duplicated.
Steps to reproduce:
Run this code using the attached xlsx file:
OPCPackage p = OPCPackage.open(sourceFilePath);
XSSFReader reader = new XSSFReader(p);
XSSFReader.SheetIterator iter = (XSSFReader.SheetIterator)
reader.getSheetsData();
while (iter.hasNext()) {
InputStream stream = iter.next();
String sheetName = iter.getSheetName();
stream.close();
System.out.println(sheetName);
}
The output is:
Sheet1
Sheet1
Sheet2
Sheet2
Sheet3
Sheet3
Sheet4
Sheet4
Sheet5
Sheet5
Sheet6
Sheet6
The expected output is:
Sheet1
Sheet2
Sheet3
Sheet4
Sheet5
Sheet6
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 61034] Call to XSSFReader.getSheetsData() returns duplicate
sheets
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61034
--- Comment #3 from Tim Allison <ta...@mitre.org> ---
Sorry, all. 1) shouldn't have introduced this and 2) should have caught this
with tika-eval...argh.
Thank you for reporting this and supplying a patch. Thank you, Javen!
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 61034] Call to XSSFReader.getSheetsData() returns duplicate
sheets
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61034
--- Comment #1 from Sebastian Wikalinski <se...@nokia.com> ---
Created attachment 34964
--> https://bz.apache.org/bugzilla/attachment.cgi?id=34964&action=edit
Proposed fix for XSSFReader.XMLSheetRefReader
Hi,
We've run into the same issue with the new version of the library. The problem
seems to be caused only by those xlsx files which have a specific order of the
attributes inside the <sheet> tag of workbook.xml
Example (which causes the problems):
<sheet name="Sheet6" r:id="rId6" sheetId="4"/>
While this one works correctly:
<sheet name="Sheet6" sheetId="4" r:id="rId6"/>
I've traced the root cause to a possible coding error in XMLSheetRefReader, for
which I'm now providing a patch. I haven't tested it very thoroughly, but it
seems to fix the problem.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 61034] Call to XSSFReader.getSheetsData() returns duplicate
sheets
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=61034
Javen O'Neal <on...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |FIXED
Status|NEW |RESOLVED
--- Comment #2 from Javen O'Neal <on...@apache.org> ---
Mauricio, thanks for the Excel test file, test case!
Sebastian, thanks for the fix!
Applied in r1793223. Will be included in POI 3.17-beta1.
https://svn.apache.org/viewvc?view=revision&revision=1793223
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org