Commit a9ebb77b authored by Luna Riegel's avatar Luna Riegel
Browse files

Fix: Cached CityObjects leaking to other files

Invalidates all Cache entries before starting parsing of a new file to
prevent cached CityObjects being unintentionally transferred to wrong
database table.
parent 616fee87
......@@ -18,6 +18,7 @@ public class CacheManager {
if (cache == null){
cache = new FeatureCache(filename);
} else {
cache.resetCache();
cache.changeFileName(filename);
}
return cache;
......
......@@ -19,4 +19,5 @@ public interface CityObjectCache {
int getFeatureCount();
void resetCache();
}
......@@ -65,6 +65,10 @@ public class FeatureCache implements CityObjectCache{
return handler.getFeatureCount();
}
@Override
public void resetCache(){
cache.invalidateAll();
}
}
......@@ -44,4 +44,8 @@ public class UnconnectedCache implements CityObjectCache{
public int getFeatureCount() {
return cache.size();
}
public void resetCache(){
cache.clear();
}
}
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