GP-2713 fix 7zip file system initialization logic

This commit is contained in:
dev747368
2022-10-18 11:01:42 -04:00
parent 35b58b3105
commit b00bd1b498

View File

@@ -73,9 +73,11 @@ public class SevenZipFileSystem implements GFileSystem {
*/
public void mount(ByteProvider byteProvider, TaskMonitor monitor)
throws CancelledException, IOException {
if (!SevenZipFileSystemFactory.initNativeLibraries()) {
throw new IOException("Could not initialize 7zip native libraries");
}
try {
szBPStream = new SZByteProviderStream(byteProvider);
SevenZip.initSevenZipFromPlatformJAR(); // calling this multiple times is ok
archive = SevenZip.openInArchive(null, szBPStream);
archiveFormat = archive.getArchiveFormat();
archiveInterface = archive.getSimpleInterface();
@@ -84,7 +86,7 @@ public class SevenZipFileSystem implements GFileSystem {
indexFiles(monitor);
ensurePasswords(monitor);
}
catch (SevenZipException | SevenZipNativeInitializationException e) {
catch (SevenZipException e) {
throw new IOException("Failed to open archive: " + fsrl, e);
}
}