﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
23165	Cannot assign a changesetId > 0 to a new primitive. Value of changesetId is 1	jochen.hebbrecht	jochen.hebbrecht	"Hi,

We have a problem opening a PBF in JOSM as of version 18700 (released 20th of March). Up & until that day, we always used the PBF plugin to open PBF files in JOSM.

As of version 18700, we can use the built-in support now for opening PBF files. This is thanks to this commit: https://github.com/JOSM/josm/commit/fbcc55340eba456e816989bca5b81015126e4c03

However, a PBF file can suddenly no longer be opened because of:
{{{
2023-08-30 22:25:43.922 SEVERE: java.lang.IllegalStateException: Cannot assign a changesetId > 0 to a new primitive. Value of changesetId is 1
java.lang.IllegalStateException: Cannot assign a changesetId > 0 to a new primitive. Value of changesetId is 1
	at org.openstreetmap.josm.data.osm.AbstractPrimitive.setChangesetId(AbstractPrimitive.java:303)
	at org.openstreetmap.josm.io.OsmPbfReader.setOsmPrimitiveData(OsmPbfReader.java:841)
	at org.openstreetmap.josm.io.OsmPbfReader.parseWay(OsmPbfReader.java:672)
	at org.openstreetmap.josm.io.OsmPbfReader.parsePrimitiveGroup(OsmPbfReader.java:449)
}}}
The file itself could perfectly be opened with an older version of JOSM. I'm trying to see if this correlates to a bug on your side, or a data issue on our side which is now exposed thanks to recent code changes?
As an intermediate conclusion, it seems that the built-in support is dealing PBF reading differently.

I have 2 questions:
* Looking at the stacktrace, it seems that JOSM is treating the 'failing' element as ""new"", meaning the ID is negative. However, in our PBF, there's not a single OSM element containing a negative ID. Can somebody explain me why JOSM converts positive ids into negative ids while reading the PBF?
* This is an example of what we have as data in our PBF
{{{
<node id=""2488317"" version=""1"" timestamp=""2023-08-24T00:00:00Z"" uid=""1"" user=""userName"" changeset=""1"" lat=""43.7325063"" lon=""7.4188489"">
  <tag k=""some_key"" v=""some_value/"">
</node>
}}}
 It seems that JOSM no longer likes the fact that we add `changeset=1` there. Any reason this check in your codebase? https://github.com/JOSM/josm/blob/master/src/org/openstreetmap/josm/data/osm/AbstractPrimitive.java#L301. Why can't the changeset value not be 1 for example?

Thanks for your help!


Jochen"	defect	closed	normal	23.11	Core		fixed		
