It's all about the answers!

Ask a question

Exception on saving userproperty on Versionable in operationParticipant

erling jorgensen (40911) | asked Aug 02 '12, 9:10 a.m.

I want to save a string on a file/folder on delivery, implemented in an operationparticipant. My code is quite simple:
IVersionable item = (IVersionable) iVersionable.getWorkingCopy();
item.setUserProperty("<Keystring>", "<valuestring>");
On the saveoperation, I get an exception:

ERROR                         - Access violation in component item service.  Service component:, 
Model component:, 
Item type: Access violation in component item service.  Service component:, Model component:, Item type:
at dk.bankdata.rtc.extensions.contributors.FileUserPropertyCreator.createUserDefinedPropertyOnChanges(
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(

I have suspect the componentid on the extensionservice is causing the failure. It is set to componentId="". But if it is wrong, I don't know a better value (I've tried several).

...and by the way: I plan to use the userproperty, assuming it is ment for users to set in customization. Is that true or am I abusing something?



Ralph Schoon commented Jan 06 '16, 5:24 a.m.

Hi Erling, I am not sure about the context of the operation. There are several things that can prevent this from working.
One is the service. There is an IScmService and I am not sure the IRepositoryItemService can do the save you want.
I searched the SDK for setUserProperty() as a method and there are several ways of how it is used, also containing save operations, which are usually done on an IWorkspaceConnection using the IWorkspaceConnection.configurationOpFactory().save(). I assume the call you are doing is not allowed in the context.

Accepted answer

permanent link
Darcy Wiborg-Weber (16) | answered Dec 08 '15, 3:12 p.m.
 Just a followup to say this was implemented in RTC 5.0.2.  Here's a link to more information:
Ralph Schoon selected this answer as the correct answer

3 other answers

permanent link
John Camelon (1.7k14) | answered Aug 07 '12, 9:40 a.m.
Versionables can only be saved via a commit operation. See IScmService#batchCommit. I am not sure If properties behave as you would like. They are baked Into the version.

permanent link
Geoffrey Clemm (30.1k23035) | answered Aug 07 '12, 11:23 p.m.
As John says, currently, a version property is part of the state of a version, and cannot be modified once that version is created by the checkin operation.  I've created work item 220897, requesting support for modifiable version properties ( ).

permanent link
erling jorgensen (40911) | answered Aug 08 '12, 2:33 p.m.
 Actually my need is to put a property value on a particular version of the versionable. In my case always the last (and current version).

Perhaps it was possible to set a version property on checkin. But can it be done in a server trigger?

erling jorgensen commented Sep 07 '12, 4:25 a.m.

My need is to set a user property on a version of an item, and to be able to modify it later (after the item is delivered).

So the workitem Geoffrey made for this is still valid .

Ralph Schoon commented Jan 06 '16, 5:55 a.m.

To put a property on an artifact, you will have to put it there in a change set that is not complete and later deliver.
If you want to be able to put information on a version of an artifact that is already delivered, since 5.0.2 there are "Attributes" that ├Żou can define and that can be changed without the need to a new version.

Your answer

Register or to post your answer.