nasa / CCDD

CFS Command and Data Dictionary Tool (CCDDT)
81 stars 31 forks source link

Corrupted structure table after adding padding and expanding rows #103

Closed 9a3eedi closed 1 year ago

9a3eedi commented 1 year ago

Hi,

I was following the CCDD tutorial today using release 2.1.4 (commit 8fb4c63fbc), and after a series of steps that I have done on my own, I seem to have caused some kind of corruption in the structure table that I was unable to recover from at the GUI (I ended up having to delete the table and restart)

Here are the steps I took:

  1. Create a new Struct table (let's call it myStruct)
  2. Edit the myStruct table
  3. Insert a row, add a new variable called myVar1 of data type int16_t
  4. Insert a row, add a new variable called myArray1 of data type float, and array size of 3
  5. Press the store button
  6. Go to Row -> Expand Arrays
  7. Add a description to each row in myArray1
  8. Press the store button
  9. Close the dialog
  10. In the main window, go to Data -> Padding. Select the myStruct Prototype table and Add/Update padding
  11. Edit the myStruct Table
  12. Go to row, expand arrays

Note that at this point, myVar (which is not an array type) shows that it has 2 elements, which is incorrect behaviour, and where the strangeness starts image

  1. Select the myVar row, and delete. It goes through, but the array elements don't go away with it. image

  2. Press the store button. There are no errors (but it should complain because of the corrupted structure!)

  3. Go to Row and deselect Expand Arrays. Note how the myVar entry disappears. This is very misleading.

  4. Close teh dialog and edit the table again. Then go to Row -> Expand arrays. You will see that the myVar array is still there, which shows that the corrupt table has been stored into the database.

  5. Close the dialog, and go to Data -> Padding, then try to add padding to the table. It will be successful.

  6. Edit the table. All the fields, including the float array, will disappear. Even if you select Expand Rows, nothing will show up.

My platform is Ubuntu 22.04 running under WSL2 on Windows 10, with VcXsrv as the X server, and using the distro-supplied package for postgresql (version 14+238). I am using the distro supplied OpenJDK version 11.0.20 2023-07-18

KevinMcCluney commented 1 year ago

Thanks for the detailed steps - that helped a lot in recreating (and correcting) the bug. The bug occurs when inserting a new row (in this case for the padding variable) when the target row is an array definition. You can see the bug in action by selecting the array myArray1 definition row, then selecting the Insert button. The new row is inserted above myVar1 instead of myArray1.

The bug will be corrected in the next release (2.1.5). In the interim I've pushed the correction to the affected class, along with an updated CCDD.jar (version 2.1.4a).

9a3eedi commented 1 year ago

I pulled the latest commit and gave it a try and can confirm that it works now! Thank you for the quick fix.