It's all about the answers!

Ask a question

error when creating work item with too long description


Attila Mate (71184) | asked Jul 11 '11, 5:11 a.m.
Hi,

I'm trying to create a work item with a long description, using
    IWorkItemHandle handle = service.getWorkItemWorkingCopyManager().connectNew(workItemType, monitor);

WorkItemWorkingCopy wc = service.getWorkItemWorkingCopyManager().getWorkingCopy(handle);
IWorkItem jazzWI = wc.getWorkItem();
...
jazzWI.setHTMLDescription(XMLString.createFromPlainText(message));

where message can be really long, so I got this exception:
com.ibm.team.repository.common.validation.PropertyConstraintException: Validation errors for item: type = WorkItem, itemId = [UUID _cSjhYKubEeCEcsklv5qnDA]

Value of attribute "description" is 34245 bytes, which is greater than the allowed encoded length of 32768 bytes.


My questions:
    1. How can I find out maximum length of a certain attribute (for example Description has max encoded length of 32768)?
    2. How can I calculate this encoded length? In this case message.length() is 27635, and XMLString.createFromPlainText(message).getXMLText().length is 32704.


Obviously I'd like to dynamically truncate 'message' to fit into work item's description attribute, so if there's any easier way to do this, that would also be appreciated.

Thanks,
Attila

One answer



permanent link
Attila Mate (71184) | answered Aug 01 '11, 8:53 a.m.
Anyone any idea?

Thanks,
Attila

Comments
khayati ohri commented Jun 11 '12, 4:10 a.m.

Any one having any idea of the above issues.I am too facing the similar issue.Any ideas/updates will be quite helpful

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.