Conversation
Contributor
|
passed Developer-testing. |
davedrp
approved these changes
May 2, 2023
nickpalladino
approved these changes
May 3, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Story: https://breedinginsight.atlassian.net/browse/BI-1760
This bug occurs when an Excel or CSV file with null/empty columns is uploaded. Such a file can be created in Excel by selecting cells and pressing delete to clear their contents, rather than deleting columns. Because the template allows dynamic columns, the Experiment & Observations upload is where users would most likely encounter this bug.
It can be observed with BreedBase or the BrAPI Java Test Server, as it is a file parsing bug, not a BrAPI/BreedBase bug.
This PR fixes the bug with the following behavior:
Unit tests and test files were added, see
FileUtilUnitTest.parseCsvRemoveAllNullColumns()andFileUtilUnitTest.parseExcelRemoveAllNullColumns().Potential Issues
My implementation of
removeNullColumnsinFileUtil.java, which is used to read CSVs:nthcolumn, it is namedCn, and it has no data (besides the header).Suggestions for a more robust implementation are welcome, but this wasn't my first or favored approach 😉.
Dependencies
No dependencies.
Testing
To test, I recommend going to an empty program, importing Germplasm using RILS and Parents.xls, and Ontology using bi_lettuce_ontology_v1.xlsx.
Then try importing Experiments & Observations using SCY RIL exp truncated missing header.xls or SCY RIL exp truncated missing header.csv. This should result in a descriptive error message being displayed.
Finally, try importing Experiments & Observations using SCY RIL exp truncated.xls or SCY RIL exp truncated.csv which have empty/null columns. This would result in the "Duplicate column names" error before this fix (the duplicate name was the empty string), but should now succeed, as empty/null columns are dropped silently.
Checklist:
Files:
RILS and Parents.xls
bi_lettuce_ontology_v1.xlsx
SCY RIL exp truncated.xls
SCY RIL exp truncated.csv
SCY RIL exp truncated missing header.xls
SCY RIL exp truncated missing header.csv