Commit 6e9e9f7d authored by Luna Riegel's avatar Luna Riegel
Browse files

Refactor: Rework error logging

parent bc94ffc4
...@@ -265,6 +265,7 @@ public class EmbeddedDatabaseHandler { ...@@ -265,6 +265,7 @@ public class EmbeddedDatabaseHandler {
Array array = con.createArrayOf("VARCHAR(255)", idStrings); Array array = con.createArrayOf("VARCHAR(255)", idStrings);
ps.setArray(1, array); ps.setArray(1, array);
ResultSet rs = ps.executeQuery(); ResultSet rs = ps.executeQuery();
boolean encounteredError = false;
Map<GmlId, CityObject> objects= new HashMap<>(); Map<GmlId, CityObject> objects= new HashMap<>();
while (rs.next()) { while (rs.next()) {
try (InputStream is = rs.getBinaryStream("data")) { try (InputStream is = rs.getBinaryStream("data")) {
...@@ -278,11 +279,13 @@ public class EmbeddedDatabaseHandler { ...@@ -278,11 +279,13 @@ public class EmbeddedDatabaseHandler {
}); });
objects.put(co.getGmlId(),co); objects.put(co.getGmlId(),co);
} catch (InvalidClassException | ClassCastException | SerializationException e){ } catch (InvalidClassException | ClassCastException | SerializationException e){
//TODO: change this log to reflect ids map //Cant get the id of the failed Feature, as the deserialization didn't work.
String msg = String.format("Deserialization of CityObject \"%s\" failed",ids); encounteredError = true;
logger.error(msg,e);
} }
} }
if (encounteredError){
logger.error("Deserialization of one or more Features failed");
}
return objects; return objects;
} catch (IOException e) { } catch (IOException e) {
throw new EmbeddedDatabaseHandlerException(e); throw new EmbeddedDatabaseHandlerException(e);
......
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