Tables with non-string empty cells make the column disappear #320

wants to merge 1 commit into


None yet
2 participants

gphilipp commented May 16, 2012

Expected :
| credits | name | birthDate |
| 1,000 | Sid Vicious | |
| 3,000 | Frank Zappa | 21/12/1940 |

Actual :
| credits | name |
| 1,000 | Sid Vicious |
| 3,000 | Frank Zappa |


gphilipp commented May 16, 2012

I'm investigating the issue. Seems to occur only with non-string fields.


gphilipp commented May 16, 2012

It doesn't happen with String fields because empty cells are parsed as empty string instead of null.
Unfortunately, it seems XStream doesn't handle null values in AbstractReflectionConverter. See line 120 :

if (info.value != null) {

Not sure what option do we have there. @aslakhellesoy any thoughts ?


aslakhellesoy commented May 17, 2012

The problem is that cucumber.table.xstream.ListOfObjectWriter assumes that XStream will write out null fields, which it won't.

This means that tableConverter.toTable(listOfPojo) won't work if one of the pojos have null fields. Null fields can result from parsing a gherkin table, but it can also result from constructing pojos manually.

I'm working on a fix in ListOfObjectWriter


gphilipp commented May 17, 2012

Excellent, thanks !

aslakhellesoy added a commit that referenced this pull request Jun 20, 2012

List<JavaBean> can be converted to a table again. This change sort of…
… breaks #320 - converting a list of beans/pojos with null fields to a table will require explicit listing of fields. Closes #335.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment