# trunkCounter in VersionedObject.java

**URL:** <https://discourse.openehr.org/t/trunkcounter-in-versionedobject-java/16642>\
**Category:** Reference Implementation: Java (archive)\
**Created:** [4 January 2007 21:07 UTC](https://discourse.openehr.org/t/trunkcounter-in-versionedobject-java/16642 "2007-01-04T21:07:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)\
**Post date:** [4 January 2007 21:07 UTC](https://discourse.openehr.org/t/trunkcounter-in-versionedobject-java/16642/1 "2007-01-04T21:07:27Z")

</div>

openehr-rm/src/main/java/org/openehr/rm/common/changecontrol/VersionedObject.java

As far as I understand, it is only used once, in comparison in  
addVersion, also I found it is never initialised.

This looks to me like a bug.

Rong or someone else, can you please comment on this

Thanks  
Bert

---

<div class="post-metadata">

**Author:** ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)\
**Post date:** [4 January 2007 21:45 UTC](https://discourse.openehr.org/t/trunkcounter-in-versionedobject-java/16642/2 "2007-01-04T21:45:45Z")

</div>

Bert Verhees schreef:

> openehr-rm/src/main/java/org/openehr/rm/common/changecontrol/VersionedObject.java
> 
> As far as I understand, it is only used once, in comparison in  
> addVersion, also I found it is never initialised.
> 
> This looks to me like a bug.
> 
> Rong or someone else, can you please comment on this

The problem is a bit different. The trunkCounter gets incremented  
everytime addVersion is called.  
addVersion is called from setVersions

trunkCounter should be set to 0 when in this code setVersions is called,  
The mpas are also recreated, so the trunkCounter should be in sync

> 

Thanks  
Bert

---

<div class="post-metadata">

**Author:** ![system](https://discourse.openehr.org/uploads/default/original/2X/f/f0a1dedb20c42747bddcafd6c7df9db5f34f003c.svg) [@system](https://discourse.openehr.org/u/system)\
**Post date:** [8 January 2007 08:55 UTC](https://discourse.openehr.org/t/trunkcounter-in-versionedobject-java/16642/3 "2007-01-08T08:55:50Z")

</div>

Hi Bert,

I will look into this. Thanks for reporting.

Regards,  
Rong
