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 2019/01/26 15:59:36 UTC

[Bug 63118] New: proposal: make Cell.setSellType(CellType.FORMULA) illegal

https://bz.apache.org/bugzilla/show_bug.cgi?id=63118

            Bug ID: 63118
           Summary: proposal: make Cell.setSellType(CellType.FORMULA)
                    illegal
           Product: POI
           Version: 4.0.x-dev
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: SS Common
          Assignee: dev@poi.apache.org
          Reporter: gallon.fizik@gmail.com
  Target Milestone: ---

Motivation: as well as any setCellType call doesn't make much sense and implies
implicit conversions/default value setting, calling
setCellType(CellType.FORMULA) makes even less sense because formula has no
default value and cannot be null. Setting formula to "0" is a workaround and,
again, is an implicit (i.e. counter-intuitive) side effect.

In all the test suite, I didn't find any reasonable usage of this call. There
were a bunch of calls in test SetUp methods (obviously, redundant) and a call
in XSSFCell ctor. *Perhaps* it wins a tiny bit in terms of performance,
although I very much doubt it.

I have the change ready and tested but am open to obections/discussion. The
change is documented in Cell interface.

-- 
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


[Bug 63118] proposal: make Cell.setCellType(CellType.FORMULA) illegal

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

gallon.fizik@gmail.com <ga...@gmail.com> changed:

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

--- Comment #2 from gallon.fizik@gmail.com <ga...@gmail.com> ---
Implemented in r1852244 - r1852247.

Changes:
* setCellType is now deprecated (@Removal = 5.0)
* setCellType(FORMULA) on a non-formula cell is illegal and throws an IAE with
a message suggesting to use setCellFormula directly.
* setCellType(FORMULA) on a formula cell does nothing
* added Cell.setBlank() to be the only use case that will survive the removal
of setCellType. Current implementation delegates to setCellType(BLANK), but at
least that's not a part of the public API.
* purged most calls to setCellType within the project. setCellType(BLANK) were
replaced with setBlank, calls with other arguments were removed wherever
possible (i.e. where it didn't break tests). Mostly these calls were in the
test suite. The only (if I didn't miss something) calls were left in tests to
verify value conversions. This logic/tests will pass away when setCellType is
removed.

-- 
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


[Bug 63118] proposal: make Cell.setCellType(CellType.FORMULA) illegal

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

--- Comment #3 from Alex <cr...@gmx.de> ---
The suggesion, to use setCellValue(...) instead would imply that the value is
known, it is not. Where as using `setCellType`, the value has not to be known.
`getStringCellValue()` is not working properly, if the CellType was not changed
to String beforehand. How can this be accomplished now, with such a
deprecation, that offers no substitute for the lost functionality?

-- 
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


[Bug 63118] proposal: make Cell.setCellType(CellType.FORMULA) illegal

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

gallon.fizik@gmail.com <ga...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|proposal: make              |proposal: make
                   |Cell.setSellType(CellType.F |Cell.setCellType(CellType.F
                   |ORMULA) illegal             |ORMULA) illegal

-- 
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


[Bug 63118] proposal: make Cell.setCellType(CellType.FORMULA) illegal

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

--- Comment #1 from Andreas Beeker <ki...@apache.org> ---
I'm +1 for making it illegal

- throw an exception with a hint (to using setCellFormula instead?) now
- mark setCellType deprecated for removal in POI 5

please also check the examples/docs for references to it

-- 
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