Bug 51963 - Comma in sheet name may cause "IllegalArgumentException: References passed to the AreaReference must be contiguous..." exception
Summary: Comma in sheet name may cause "IllegalArgumentException: References passed to...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: POI Overall (show other bugs)
Version: unspecified
Hardware: PC All
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-05 15:24 UTC by Paul Spencer
Modified: 2011-10-05 21:19 UTC (History)
0 users



Attachments
The only sheet is named "Abc,1" (6.97 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2011-10-05 17:45 UTC, Paul Spencer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Spencer 2011-10-05 15:24:39 UTC
The comma is a valid character in a Sheet Name, but org.apache.poi.ss.util.AreaReference.isContiguous() sees it as a separator and throws an IllegalArgumentException.

isContiguous() should excluded the sheet name when looking for commas.
Comment 1 Nick Burch 2011-10-05 17:06:35 UTC
Any chance you could upload a simple file with a sheet containing a comma, along with a (currently failing) unit test that tries to do an area reference on the sheet?
Comment 2 Paul Spencer 2011-10-05 17:45:40 UTC
Created attachment 27698 [details]
The only sheet is named "Abc,1"

***
* Sample of code that generated the exception.
***
String RegionName = "Intekon.ProdCodes"
Name namedRegion = workbook.getName(regionName);
if (namedRegion != null && !namedRegion.isDeleted()) {
  if ((sheetName == null) || sheetName.equals(namedRegion.getSheetName())) {
    regions.add(namedRegion);
  }
}
Comment 3 Paul Spencer 2011-10-05 17:47:17 UTC
This issue was detected in v3.5, but as of v3.4-Beta 4 the issues still exists
Comment 4 Nick Burch 2011-10-05 21:19:24 UTC
Thanks for the test file, should be fixed in r1179444.

It's probably worth pointing out that AreaReference has a big TODO in it about consolidating the area and reference parsing code from about 4 classes, in case anyone fancies tackling that one....!