socrata / datasync

Desktop / Console application for updating Socrata datasets automatically.
http://socrata.github.io/datasync/
MIT License
79 stars 33 forks source link

Bug: EN-833 - Null pointer exception when selecting an item that has already been mapped #121

Closed spaceballone closed 8 years ago

spaceballone commented 8 years ago

Repro

  1. Pick a CSV and a dataset to update
  2. Click map fields
  3. Set the first field to map to a specific field in the dataset
  4. Set the second field to map to the same field

Expected: That the first would say "ignore this column" and the second would map to the same field

Actual: Null pointer exception. They both map to the same field.

Cause

Consumers of the ControlFileModel assume that the values in the columns array are never null. The code that manages collisions (e.g. I select "vendor" for two different columns) was violating this assumption, setting the previous value to null. When this value was read later in the flow, we would get a null pointer exception which would cause this to fail.

This commit also removes the dialog box which incorrectly prompted the user when he or she had columns in the dataset which were not mapped, and they were trying to do a replace. Now, we simply inform them that they don't have a mapping and block until they set a mapping.

QA: Verified that I was able to set and reset various columns. Validated that I can still update a dataset. Verified that the output of the control file was correct.

Reviewed-by: TBD

rozap commented 8 years ago

Seems legit, :shipit: