Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 1 commit into from
Closed

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

wants to merge 1 commit into from

Conversation

gphilipp
Copy link
Contributor

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
Copy link
Contributor Author

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

@gphilipp
Copy link
Contributor Author

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
Copy link
Contributor

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
Copy link
Contributor Author

Excellent, thanks !

aslakhellesoy added a commit that referenced this pull request Jun 20, 2012
… breaks #320 - converting a list of beans/pojos with null fields to a table will require explicit listing of fields. Closes #335.
@lock
Copy link

lock bot commented Oct 25, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants