Commit 8dffaa6a authored by Riegel's avatar Riegel
Browse files

Refactor: Cleanup code

2 merge requests!28Version 3.17.0 Release,!26Add ZIP-archive support
Showing with 4 additions and 8 deletions
+4 -8
...@@ -27,9 +27,7 @@ public class CityGmlArchive { ...@@ -27,9 +27,7 @@ public class CityGmlArchive {
@Serial @Serial
private static final long serialVersionUID = 2168389511043362615L; private static final long serialVersionUID = 2168389511043362615L;
private List<CityGmlZipEntry> entries; private final List<CityGmlZipEntry> entries;
private boolean validated = false;
public static CityGmlArchive fromZipFile(String zipFile, ParserConfiguration config) { public static CityGmlArchive fromZipFile(String zipFile, ParserConfiguration config) {
ArrayList<CityGmlZipEntry> archiveEntries = new ArrayList<>(); ArrayList<CityGmlZipEntry> archiveEntries = new ArrayList<>();
...@@ -48,9 +46,9 @@ public class CityGmlArchive { ...@@ -48,9 +46,9 @@ public class CityGmlArchive {
} }
} }
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException(e); logger.error(e);
} catch (Exception e){ } catch (Exception e){
// Catch and rethrow Exception to ensure tmpDir deletion // Catch and rethrow other Exceptions to ensure tmpDir deletion in finally block
throw e; throw e;
} finally { } finally {
if (tmpDir != null) { if (tmpDir != null) {
...@@ -61,7 +59,7 @@ public class CityGmlArchive { ...@@ -61,7 +59,7 @@ public class CityGmlArchive {
} }
} }
} }
logger.info("Parsed zip-archive with {} entries", archiveEntries.size()); logger.info("Zip-archive successfully uncompressed, {} CityGml files detected", archiveEntries.size());
return new CityGmlArchive(archiveEntries); return new CityGmlArchive(archiveEntries);
} }
...@@ -74,12 +72,10 @@ public class CityGmlArchive { ...@@ -74,12 +72,10 @@ public class CityGmlArchive {
} }
public void checkEntries(){ public void checkEntries(){
validated = false;
for(CityGmlZipEntry entry : entries){ for(CityGmlZipEntry entry : entries){
Checker checker = new Checker(entry.getModel()); Checker checker = new Checker(entry.getModel());
checker.runChecks(); checker.runChecks();
} }
validated = true;
} }
public List<CityGmlZipEntry> getEntries() { public List<CityGmlZipEntry> getEntries() {
......
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