Index: /applications/editors/josm/plugins/pbf/src/org/openstreetmap/josm/plugins/pbf/io/PbfWriter.java
===================================================================
--- /applications/editors/josm/plugins/pbf/src/org/openstreetmap/josm/plugins/pbf/io/PbfWriter.java	(revision 32864)
+++ /applications/editors/josm/plugins/pbf/src/org/openstreetmap/josm/plugins/pbf/io/PbfWriter.java	(revision 32865)
@@ -7,4 +7,5 @@
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Comparator;
 import java.util.List;
 import java.util.Map.Entry;
@@ -98,8 +99,15 @@
                         stable.incr(tag.getValue());
                     }
-                    if (!omit_metadata && i.getUser() != null) {
-                        stable.incr(i.getUser().getName());
-                    }
-                }
+                    if (!omit_metadata) {
+                        stable.incr(getUserId(i));
+                    }
+                }
+            }
+
+            private String getUserId(OsmPrimitive osm) {
+                String userId = osm.getUser() != null ? osm.getUser().getName() : null;
+                if (userId == null)
+                    userId = "";
+                return userId;
             }
 
@@ -117,5 +125,5 @@
 
                     int uid = e.getUser() == null ? -1 : (int) e.getUser().getId();
-                    int userSid = stable.getIndex(e.getUser() == null ? "" : e.getUser().getName());
+                    int userSid = stable.getIndex(getUserId(e));
                     int timestamp = (int) (e.getTimestamp().getTime() / date_granularity);
                     int version = e.getVersion();
@@ -187,5 +195,5 @@
 
                 for (Node i : contents) {
-                    long id = i.getId();
+                    long id = i.getUniqueId();
                     bi.addId(id - lastid);
                     lastid = id;
@@ -225,5 +233,5 @@
                 Osmformat.PrimitiveGroup.Builder builder = Osmformat.PrimitiveGroup.newBuilder();
                 for (Node i : contents) {
-                    long id = i.getId();
+                    long id = i.getUniqueId();
                     LatLon coor = i.getCoor();
                     int lat = mapDegrees(coor.lat());
@@ -258,8 +266,8 @@
                 for (Way i : contents) {
                     Osmformat.Way.Builder bi = Osmformat.Way.newBuilder();
-                    bi.setId(i.getId());
+                    bi.setId(i.getUniqueId());
                     long lastid = 0;
                     for (Node j : i.getNodes()) {
-                        long id = j.getId();
+                        long id = j.getUniqueId();
                         bi.addRefs(id - lastid);
                         lastid = id;
@@ -300,10 +308,10 @@
                 for (Relation i : contents) {
                     Osmformat.Relation.Builder bi = Osmformat.Relation.newBuilder();
-                    bi.setId(i.getId());
+                    bi.setId(i.getUniqueId());
                     RelationMember[] arr = new RelationMember[i.getMembers().size()];
                     i.getMembers().toArray(arr);
                     long lastid = 0;
                     for (RelationMember j : i.getMembers()) {
-                        long id = j.getMember().getId();
+                        long id = j.getMember().getUniqueId();
                         bi.addMemids(id - lastid);
                         lastid = id;
@@ -477,13 +485,8 @@
         public void process(DataSet ds) {
             processor.processSources(ds.dataSources);
-            for (Node n : ds.getNodes()) {
-                processor.processNode(n);
-            }
-            for (Way w : ds.getWays()) {
-                processor.processWay(w);
-            }
-            for (Relation r : ds.getRelations()) {
-                processor.processRelation(r);
-            }
+            Comparator<OsmPrimitive> cmp = Comparator.comparingLong(OsmPrimitive::getUniqueId);
+            ds.getNodes().stream().sorted(cmp).filter(n -> n.isLatLonKnown()).forEach(processor::processNode);
+            ds.getWays().stream().sorted(cmp).filter(w -> w.getNodesCount() > 0).forEach(processor::processWay);
+            ds.getRelations().stream().sorted(cmp).filter(r -> r.getMembersCount() > 0).forEach(processor::processRelation);
         }
 
Index: /applications/editors/josm/plugins/pbf/test/unit/org/openstreetmap/josm/plugins/pbf/io/PbfExporterTest.java
===================================================================
--- /applications/editors/josm/plugins/pbf/test/unit/org/openstreetmap/josm/plugins/pbf/io/PbfExporterTest.java	(revision 32864)
+++ /applications/editors/josm/plugins/pbf/test/unit/org/openstreetmap/josm/plugins/pbf/io/PbfExporterTest.java	(revision 32865)
@@ -7,5 +7,4 @@
 import java.nio.file.Path;
 
-import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
@@ -33,5 +32,4 @@
      */
     @Test
-    @Ignore("TODO: to fix")
     public void testTicket11169() throws Exception {
         try (InputStream is = Compression.ZIP.getUncompressedInputStream(
