Bug 53965

Summary: XmlValueOutOfRangeException calling getDataValidations for custom validations with XSSFSheet
Product: POI Reporter: Stuart Owen <sowen>
Component: XSSFAssignee: POI Developers List <dev>
Status: RESOLVED FIXED    
Severity: major    
Priority: P2    
Version: 3.8-FINAL   
Target Milestone: ---   
Hardware: PC   
OS: All   

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.