Upgrade class: provide alternate way to load the old H2 driver #4211
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.
Fix #3470 by providing an alternate way to provision the old driver for the upgrade procedure.
The
Upgrade.upgrade
andUpgrade.loadH2
functions get new overloads allowing a ClassLoader for the old driver JAR to be passed. Currently the user has to pass the old version number and the code calls Maven to download the corresponding JAR, but this may be problematic in certain environments as described in the original issue.For example, if using H2 from an OSGi environment, users can now load the corresponding bundle and pass the ClassLoader to the new overload of
upgrade
.TODO: I would also like to add relevant code to TestUpgrade, but I am unfamiliar with the custom testing framework used in the project. I will keep thinking about it, but in the meantime the changes to the main codebase can be reviewed.