Skip to content

Commit 7f0e701

Browse files
committed
If @id is present save json for @ref in PointReader
1 parent 1d6fa60 commit 7f0e701

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main/java/de/komoot/photon/elasticsearch/Replicatior.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public void run() {
9999
InputStream in = new BufferedInputStream(new GZIPInputStream(urlConnection.getInputStream()));
100100
JsonReader reader = new JsonReader(in);
101101
reader.addReader(com.vividsolutions.jts.geom.Point.class, new PointReader());
102+
102103
List<PhotonAction> actions = (List<PhotonAction>) reader.readObject();
103104
int deletions = 0;
104105
int updates = 0;
@@ -166,7 +167,14 @@ public Point read(Object jOb, Deque<JsonObject<String, Object>> stack, Map<Strin
166167
} else { // crash and burn
167168
throw new IllegalArgumentException("PointReader unknown serialisation " + c.getClass().getCanonicalName() + " " + c.toString());
168169
}
169-
return factory.createPoint(new Coordinate(coords[0], coords[1]));
170+
if (coords[0] != null && coords[1] != null) {
171+
if (((JsonObject) jOb).hasId()) {
172+
// this isn't done automatically
173+
Support.getReader(args).getObjectsRead().put(((JsonObject) jOb).getId(), coordinates);
174+
}
175+
return factory.createPoint(new Coordinate(coords[0], coords[1]));
176+
}
177+
throw new IllegalArgumentException("PointReader invlaid coordinates " + c.getClass().getCanonicalName() + " " + c.toString());
170178
}
171179
}
172180
}

0 commit comments

Comments
 (0)