Bug 44892 - [patch] HSSFWorkbook.getSheet(String name) should be case insensitive
Summary: [patch] HSSFWorkbook.getSheet(String name) should be case insensitive
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-FINAL
Hardware: PC Windows XP
: P1 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-04-28 11:02 UTC by a.degoy
Modified: 2008-04-30 20:24 UTC (History)
0 users



Attachments
svn diff of 5 changed files (6.07 KB, patch)
2008-04-28 13:36 UTC, Josh Micich
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description a.degoy 2008-04-28 11:02:25 UTC
Version : 3.0.2-20080204

In HSSFWorkbook the getSheet function is case sensitive :
"
  public HSSFSheet getSheet(String name)
    {
        HSSFSheet retval = null;

        for (int k = 0; k < sheets.size(); k++)
        {
            String sheetname = workbook.getSheetName(k);

            if (sheetname.equals(name)) // here is the problem
            {
                retval = (HSSFSheet) sheets.get(k);
            }
        }
        return retval;
    }
"

MS Excel or OpenOffice are non case sensitive for sheetName : equalsignorecase should be used instead of equals.
Comment 1 Josh Micich 2008-04-28 13:36:38 UTC
Created attachment 21875 [details]
svn diff of 5 changed files

Seems like a similar change is required in Workbook.doesContainsSheetName(String, int).  Updated javadocs and added one junit.

Saved patch as an attachment because svn is not taking commits right now.
Comment 2 Josh Micich 2008-04-30 20:24:49 UTC
(In reply to comment #1)
> Created an attachment (id=21875) [details]

Applied in svn r652426