error when creating work item with too long description
Hi,
I'm trying to create a work item with a long description, using
where message can be really long, so I got this exception:
My questions:
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
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