GP-3445: Fixed an IllegalStateException that could occur if both "Load

Local Libraries From Disk" and "Load System Libraries From Disk" options
are used during import, and the same library is found in both local and
system directories
This commit is contained in:
Ryan Kurtz
2023-06-05 06:55:50 -04:00
parent adf7b18547
commit 0d3d65de23

View File

@@ -507,6 +507,7 @@ public abstract class AbstractLibrarySupportLoader extends AbstractProgramLoader
// options turned off (if shouldSearchAllPaths() is overridden to return true).
// In this case, we still want to process those libraries, but we
// do not want to save them, so they can be released.
boolean loadedLocal = false;
if (!localSearchPaths.isEmpty()) {
Loaded<Program> loadedLibrary = loadLibraryFromSearchPaths(
libraryName, provider, localSearchPaths, libraryDestFolderPath,
@@ -514,13 +515,14 @@ public abstract class AbstractLibrarySupportLoader extends AbstractProgramLoader
if (loadedLibrary != null) {
if (loadLocalLibraries) {
loadedPrograms.add(loadedLibrary);
loadedLocal = true;
}
else {
loadedLibrary.release(consumer);
}
}
}
if (!systemSearchPaths.isEmpty()) {
if (!loadedLocal && !systemSearchPaths.isEmpty()) {
Loaded<Program> loadedLibrary = loadLibraryFromSearchPaths(
libraryName, provider, systemSearchPaths, libraryDestFolderPath,
unprocessed, depth, desiredLoadSpec, options, log, consumer, monitor);