Ticket #11169: fix_pbfwriter.patch
File fix_pbfwriter.patch, 3.3 KB (added by , 8 years ago) |
---|
-
pbf/src/org/openstreetmap/josm/plugins/pbf/io/PbfWriter.java
97 97 stable.incr(tag.getKey()); 98 98 stable.incr(tag.getValue()); 99 99 } 100 if (!omit_metadata && i.getUser() != null) { 101 stable.incr(i.getUser().getName()); 100 if (!omit_metadata) { 101 String userId = i.getUser() != null ? i.getUser().getName() : null; 102 if (userId == null) 103 userId = ""; 104 stable.incr(userId); 102 105 } 103 106 } 104 107 } … … 116 119 for (OsmPrimitive e : entities) { 117 120 118 121 int uid = e.getUser() == null ? -1 : (int) e.getUser().getId(); 119 int userSid = stable.getIndex(e.getUser() == null ? "" : e.getUser().getName()); 122 String userId = e.getUser() != null ? e.getUser().getName() : null; 123 if (userId == null) 124 userId = ""; 125 int userSid = stable.getIndex(userId); 120 126 int timestamp = (int) (e.getTimestamp().getTime() / date_granularity); 121 127 int version = e.getVersion(); 122 128 long changeset = e.getChangesetId(); … … 476 482 477 483 public void process(DataSet ds) { 478 484 processor.processSources(ds.dataSources); 479 for (Node n : ds.getNodes()) { 480 processor.processNode(n); 481 } 482 for (Way w : ds.getWays()) { 483 processor.processWay(w); 484 } 485 for (Relation r : ds.getRelations()) { 486 processor.processRelation(r); 487 } 485 ds.getNodes().stream().sorted((n1, n2) -> Long.compare(n1.getUniqueId(), n2.getUniqueId())) 486 .filter(n -> n.getCoor() != null).forEach((n) -> processor.processNode(n)); 487 ds.getWays().stream().sorted((w1, w2) -> Long.compare(w1.getUniqueId(), w2.getUniqueId())) 488 .filter(w -> w.getNodesCount() > 0).forEach((w) -> processor.processWay(w)); 489 ds.getRelations().stream().sorted((r1, r2) -> Long.compare(r1.getUniqueId(), r2.getUniqueId())) 490 .filter(r -> r.getMembersCount() > 0).forEach((r) -> processor.processRelation(r)); 488 491 } 489 492 490 493 public void complete() { -
pbf/test/unit/org/openstreetmap/josm/plugins/pbf/io/PbfExporterTest.java
32 32 * @throws Exception if an error occurs 33 33 */ 34 34 @Test 35 @Ignore("TODO: to fix")36 35 public void testTicket11169() throws Exception { 37 36 try (InputStream is = Compression.ZIP.getUncompressedInputStream( 38 37 new FileInputStream(TestUtils.getRegressionDataFile(11169, "Portsmouth_Area.osm.zip")))) {