Closed buthanoid closed 2 years ago
OIFitsCollectionManager
(OCM) class contains two collection classes: OIFitsCollection
& OiDataCollection
addOIFitsFile(OIFitsFile)
.
OIFitsCollection
: addOIFitsFile(OIFitsFile)
OIFitsCollection.addOIFitsFile
to do nothing when there is a previous file OIFitsCollectionManager.addOIFitsFile
to modify the current OIDataFile if there exist one... that is, replace the reference to the old OIFitsFile by the new one. in this way, no need to modify the TableUID as they would still point to the same OIDataFile object.I think this bug is related to missing reference checks... I am implementing now.
Anyway I agree solution 2 is expected: explicit update any or first oidatafile reference ( as filepath is unique) is better
What is the problem
If I add a file. If I add another time a file of the same filepath. Then OIFitsCollection uses the updated file content, and OIDataCollection uses the old file content. This is an inconsistent state.
What did you expect
Both collections to be updated. Every reference to the old OIFitsFile object must disappear.
Describe how to reproduce or add a test
Context information
Technical details
The culprit is the function
OIFitsCollectionManager.addOIFitsFile
. It callsOIFitsCollection.addOIFitsFile
which replaces the old OIFitsFile object by the new one, and then it does not do the same forOIDataCollection
, whereas it should. BTW there is a related TODO in OIFItsCollection.addOIFitsFile