Bug 53965 - XmlValueOutOfRangeException calling getDataValidations for custom validations with XSSFSheet
Summary: XmlValueOutOfRangeException calling getDataValidations for custom validations...
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: XSSF (show other bugs)
Version: 3.8-FINAL
Hardware: PC All
: P2 major with 1 vote (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-04 13:55 UTC by Stuart Owen
Modified: 2012-10-12 15:04 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stuart Owen 2012-10-04 13:55:02 UTC
I've encountered a problem using custom Data Validations with XSSF sheets. Adding the validation seems to work OK, but afterwards when I try getValidations I get an XmlValueOutOfRangeException (full stack trace below). The contents of the validation formula doesn't seem to matter, and things seem to work correctly if I load a xlsx workbook containing custom validations and then try to access them. Here is some simplified example code that demonstrates the problem:

        XSSFWorkbook wb = new XSSFWorkbook();
        XSSFSheet sheet = wb.createSheet();
        sheet.getDataValidations();    //<-- works

        //create the cell that will have the validation applied
        sheet.createRow(0).createCell(0);

        DataValidationHelper dataValidationHelper = sheet.getDataValidationHelper();
        DataValidationConstraint constraint = dataValidationHelper.createCustomConstraint("SUM($A$1:$A$1) <= 3500");
        CellRangeAddressList addressList = new CellRangeAddressList(0, 0, 0, 0);
        DataValidation validation = dataValidationHelper.createValidation(constraint, addressList);
        sheet.addValidationData(validation);

        sheet.getDataValidations();    //<-- raised XmlValueOutOfRangeException

I also have the same problem when operating on an exisiting workbook that contains sheets and cells, I've just simplified the code above.
Comment 1 Yegor Kozlov 2012-10-10 15:42:25 UTC
Fixed in r1396650

Yegor
Comment 2 Stuart Owen 2012-10-12 15:04:34 UTC
Trying the nightly build (20121011), I can confirm that this is now fixed. Thanks Yegor.