You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2010/09/03 08:27:49 UTC

DO NOT REPLY [Bug 49873] New: XSSFFormulaEvaluator.evaluate() can not handle blank cells

https://issues.apache.org/bugzilla/show_bug.cgi?id=49873

           Summary: XSSFFormulaEvaluator.evaluate() can not handle blank
                    cells
           Product: POI
           Version: 3.6-dev
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: i8c.alex@gmail.com


If you try to evaluate() a blank cell, you will get an IllegalStateException()
because cellType "3" is not known (Cell.CELL_TYPE_BLANK = 3).

This can be solved in the parent code by checking if the cell is blank before
evaluating, but I think it would be easier to allow you to evaluate a blank
cell at which point you simply receive a CellValue with type blank.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 49873] XSSFFormulaEvaluator.evaluate() can not handle blank cells

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49873

--- Comment #1 from alex <i8...@gmail.com> 2010-09-03 02:31:01 EDT ---
Created an attachment (id=25977)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25977)
Creates a static method to create a cellvalue with type CELL_TYPE_BLANK

Please note that the patches have not yet been tested.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 49873] XSSFFormulaEvaluator.evaluate() can not handle blank cells

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49873

--- Comment #2 from alex <i8...@gmail.com> 2010-09-03 02:31:50 EDT ---
Created an attachment (id=25978)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=25978)
Updates XSSFFormulaEvaluator to allow for evaluation of blank cells

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 49873] XSSFFormulaEvaluator.evaluate() can not handle blank cells

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49873

Yegor Kozlov <ye...@dinom.ru> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Yegor Kozlov <ye...@dinom.ru> 2010-09-04 11:07:45 EDT ---
Fixed in r992620.

The correct behavior is to return null - FormulaEvaluator should behave the
same whether the cell is null or blank. This is how HSSF's evaluator is
implemented and I don't see why XSSF should behave differently.

Regards,
Yegor

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 49873] XSSFFormulaEvaluator.evaluate() can not handle blank cells

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49873

--- Comment #5 from Yegor Kozlov <ye...@dinom.ru> 2010-09-06 06:44:29 EDT ---
(In reply to comment #4)
> I do not know if it is allowed to comment on resolved issues (if not, please
> excuse my ignorance), but I would like to point out that while I understand
> that you want both implementations to work the same, I think it would be easier
> to return a blank cell in the following situation:
> 
> CellValue cellValue = evaluator.evaluate(cell);
> switch(cellValue.getCellType()) {
> ...
> }
> 
> This will throw a nullpointer exception if evaluator returns "null" for blank
> cells. It is of course entirely feasible to check for "== null" before doing
> the switch, but isn't that partly the point of having a "CELL_TYPE_BLANK"?


what you suggest makes sense,  but current code exists for a long time and used
in many production systems. Changing the returned value from null to
CellValue.BLANK  may cause incompatibility issues. This is the main reason why
I had to reject it.

Yegor

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org


DO NOT REPLY [Bug 49873] XSSFFormulaEvaluator.evaluate() can not handle blank cells

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=49873

--- Comment #4 from alex <i8...@gmail.com> 2010-09-06 01:44:05 EDT ---
I do not know if it is allowed to comment on resolved issues (if not, please
excuse my ignorance), but I would like to point out that while I understand
that you want both implementations to work the same, I think it would be easier
to return a blank cell in the following situation:

CellValue cellValue = evaluator.evaluate(cell);
switch(cellValue.getCellType()) {
...
}

This will throw a nullpointer exception if evaluator returns "null" for blank
cells. It is of course entirely feasible to check for "== null" before doing
the switch, but isn't that partly the point of having a "CELL_TYPE_BLANK"?

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org