Created attachment 424575 [details]
Description of problem:
If you upload a bundle distribution file, and before finishing the Create Wizard, you cancel it, then try to upload the bundle distribution file again, you get an exception.
Steps to Reproduce:
1. Create a New bundle, upload a bundle distribution file, then step through the Create Wizard stopping at the final "Summary" step page.
2. At the final Summary step, click the cancel button (do NOT click finish; just cancel button)
3. Repeat step 1 with the same bundle distro file
4. At the final Summary step, click the "Finish" button (do NOT cancel)
You get an error in the message panel saying it failed to create the bundle. See the attached stack trace for the actual error.
It should have created the bundle properly.
I think this has to do with our "bundle delete" code. We need to make sure we clean up everything on a delete.
I have not been able to reproduce this, maybe something else is going on in order to get this to happen.
I just got this again. Before doing the replication steps described here, upload another bundle distribution file. Once you get a bundle distro file in the DB, then do the steps here. For example, I have two bundle distro files:
I uploaded the v1.0 successfully. Then I went through the create wizard with v2.0 but canceled at the end. I then uploaded v2.0 again, but this time I did not cancel.
fix commit: e71e170a064a93f981f0e8d773a28bccb2897484
The problem here is that we did neither of the following:
1) when removing a BundleVersion remove the PackageVersions for its BundleFiles.
2) when creating a BundleVersion reuse a PackageVersion if it was already there.
So, PackageVersions for a Bundle were only removed if the Bundle itself was deleted.
To solve the problem we now do (1). We now cascade remove (via Hibernate) the PV when the BundleFile is removed.
This works because we always create a new PV for a BV's BundleFiles. The PV is versioned after the BV. If in the future we decide to reuse a PV if it is physically the same file used by multiple BVs, or possibly refer to PVs outside of the Bundle's own repo, then this strategy will need to be updated.
Verified on JON 2.4 GA_QA build#42
Uploaded 1st version of a bundle distribution file. Went through the create wizard with 2nd version and canceled at the summary page. I then uploaded v2.0 again and clicked 'Finish' button on summary page. The 2nd version is uploaded successfully.
No exception is observed.
Mass-closure of verified bugs against JON.