Ticket #19532: 19532-fix.patch
File 19532-fix.patch, 1.7 KB (added by , 4 years ago) |
---|
-
src/org/openstreetmap/josm/data/osm/UniqueIdGenerator.java
39 39 } 40 40 idCounter.set(newId); 41 41 } 42 43 44 /** 45 * Generates a new primitive unique id. Uses the given value if that is smaller than the current id. 46 * @param wanted the wanted id 47 * @return long that is either equal 48 * @since xxx 49 */ 50 public long advanceOrGenerate(long wanted) { 51 return idCounter.updateAndGet(x -> wanted < x ? wanted : x - 1); 52 } 42 53 } -
src/org/openstreetmap/josm/io/AbstractReader.java
622 622 623 623 protected OsmPrimitive buildPrimitive(PrimitiveData pd) { 624 624 OsmPrimitive p; 625 if (pd.getUniqueId() < pd.getIdGenerator().currentUniqueId()) { 626 p = pd.getType().newInstance(pd.getUniqueId(), true); 627 pd.getIdGenerator().advanceUniqueId(pd.getUniqueId()); 625 final long id = pd.getUniqueId() > 0 ? pd.getId() : pd.getIdGenerator().advanceOrGenerate(pd.getUniqueId()); 626 627 if (id < 0) { 628 p = pd.getType().newInstance(id, true); 628 629 } else { 629 p = pd.getType().newVersionedInstance( pd.getId(), pd.getVersion());630 p = pd.getType().newVersionedInstance(id, pd.getVersion()); 630 631 } 631 632 p.setVisible(pd.isVisible()); 632 633 p.load(pd);