Bug 56930 - XSSFWorkbook ignores XSSFName's that have the same name
Summary: XSSFWorkbook ignores XSSFName's that have the same name
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: unspecified
Hardware: All All
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2014-09-08 17:30 UTC by liad.matas
Modified: 2016-03-13 21:36 UTC (History)
0 users

An example of getName error (614 bytes, text/plain)
2014-09-08 17:30 UTC, liad.matas

Note You need to log in before you can comment on or make changes to this bug.
Description liad.matas 2014-09-08 17:30:16 UTC
Created attachment 31976 [details]
An example of getName error

Methods in XSSFWorkbook seem to ignore the fact that we can have several XSSFName's with the same name in different scopes.

XSSFWorkbook.getName(String name), XSSFWorkbook.getNameIndex(String name), XSSFWorkbook.removeName(String name), and possibly other methods are affected by this.

In the attachment you can see that getName returns the 1st XSSFName it finds. A better solution would be to return a collection of results.
Comment 1 Dominik Stadler 2016-03-13 21:36:22 UTC
In r1734863 we have now added a getNames() method to Workbook and its  implementations. We did not remove the existing getName() methods to keep backwards compatibility with existing code.