Commit b7304ed1 authored by Riegel's avatar Riegel
Browse files

Fix: Prevent crashing due to malformed zipEntry

2 merge requests!28Version 3.17.0 Release,!26Add ZIP-archive support
Showing with 15 additions and 9 deletions
+15 -9
...@@ -10,10 +10,12 @@ import java.io.FileInputStream; ...@@ -10,10 +10,12 @@ import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.Serial; import java.io.Serial;
import java.io.Serializable; import java.io.Serializable;
import java.nio.charset.MalformedInputException;
import java.nio.file.Path; import java.nio.file.Path;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipException;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;
...@@ -47,6 +49,9 @@ public class CityGmlZipArchive implements Serializable { ...@@ -47,6 +49,9 @@ public class CityGmlZipArchive implements Serializable {
} catch (IOException e) { } catch (IOException e) {
logger.error("Encountered an IOError while registering CityGmlArchive", e); logger.error("Encountered an IOError while registering CityGmlArchive", e);
return null; return null;
} catch (Exception e) {
logger.error("Encountered an unexpected error while registering CityGmlArchive", e);
return null;
} }
} }
......
...@@ -154,15 +154,16 @@ public class CityDoctorController { ...@@ -154,15 +154,16 @@ public class CityDoctorController {
currentConfig = new ParserConfiguration(numberOfRoundingPlaces, useValidation, lowMemory); currentConfig = new ParserConfiguration(numberOfRoundingPlaces, useValidation, lowMemory);
zipArchive = CityGmlZipArchive.register(path); zipArchive = CityGmlZipArchive.register(path);
if (zipArchive != null) {
Platform.runLater(() -> { Platform.runLater(() -> {
try { try {
currentZipEntryManager = new ZipEntryManager(mainWindow.getMainStage(), this); currentZipEntryManager = new ZipEntryManager(mainWindow.getMainStage(), this);
currentZipEntryManager.show(); currentZipEntryManager.show();
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }
}); });
}
} }
public void decompressZipEntry(CityGmlZipEntry entry, ProgressListener l) { public void decompressZipEntry(CityGmlZipEntry entry, ProgressListener l) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment