Commit ac539686 authored by Riegel's avatar Riegel
Browse files

Fix: Parsing of LibraryObjects in CityGmlZipArchive

parent 0a152a4c
...@@ -823,7 +823,8 @@ public class Citygml3FeatureMapper extends ObjectWalker { ...@@ -823,7 +823,8 @@ public class Citygml3FeatureMapper extends ObjectWalker {
libObj = LibraryObject.of(libraryObjectPath, config); libObj = LibraryObject.of(libraryObjectPath, config);
} else { } else {
String libraryObjectPath = ig.getLibraryObject(); String libraryObjectPath = ig.getLibraryObject();
CityGmlZipEntry libEntry = zipEntry.getArchive().getEntry(libraryObjectPath); Path loPath = zipEntry.resolveLibraryObjectPath(libraryObjectPath);
CityGmlZipEntry libEntry = zipEntry.getArchive().getEntry(loPath.toString());
libObj = LibraryObject.of(libEntry, config); libObj = LibraryObject.of(libEntry, config);
} }
if (libObj != null) { if (libObj != null) {
......
...@@ -12,6 +12,7 @@ import org.apache.logging.log4j.Logger; ...@@ -12,6 +12,7 @@ import org.apache.logging.log4j.Logger;
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.file.Path;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
public class CityGmlZipEntry implements Serializable { public class CityGmlZipEntry implements Serializable {
...@@ -20,6 +21,7 @@ public class CityGmlZipEntry implements Serializable { ...@@ -20,6 +21,7 @@ public class CityGmlZipEntry implements Serializable {
@Serial @Serial
private static final long serialVersionUID = -5732913269959043262L; private static final long serialVersionUID = -5732913269959043262L;
private final Path filePath;
private final String fileName; private final String fileName;
private final String displayName; private final String displayName;
private transient CityDoctorModel model; private transient CityDoctorModel model;
...@@ -91,8 +93,8 @@ public class CityGmlZipEntry implements Serializable { ...@@ -91,8 +93,8 @@ public class CityGmlZipEntry implements Serializable {
protected CityGmlZipEntry(ZipEntry entry, CityGmlZipArchive parentArchive, boolean decompressed) { protected CityGmlZipEntry(ZipEntry entry, CityGmlZipArchive parentArchive, boolean decompressed) {
this.fileName = entry.getName(); this.fileName = entry.getName();
String[] nameSplits = fileName.split("/"); this.filePath = Path.of(entry.getName());
this.displayName = nameSplits[nameSplits.length - 1]; this.displayName = filePath.getFileName().toString();
if (entry.getSize() != -1) { if (entry.getSize() != -1) {
this.fileSize = entry.getSize(); this.fileSize = entry.getSize();
} }
...@@ -129,6 +131,10 @@ public class CityGmlZipEntry implements Serializable { ...@@ -129,6 +131,10 @@ public class CityGmlZipEntry implements Serializable {
fileSize = size; fileSize = size;
} }
public Path resolveLibraryObjectPath(String libraryObjectPath) {
return filePath.getParent().resolve(libraryObjectPath);
}
public boolean isDecompressed() { public boolean isDecompressed() {
return decompressed; return decompressed;
} }
......
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