How to solve "Value of attribute "mediumStringExtensions.value" is 1214 bytes, which is greater than the allowed encoded length of 1000 bytes"?
I am using line breaker and some spaces in my string. This is my code to get size of the string -> anyString.getBytes(StandardCharsets.UTF_8).length;
My field maximum byte size is 1000 bytes and my code is returning 980 bytes as size and in jazz it is throwing an error like "Value of attribute "mediumStringExtensions.value" is 1214 bytes, which is greater than the allowed encoded length of 1000 bytes."
Can you please tell how to calculate byte size to match with jazz field?
For example how to calculate different byte sizes for line breaker , space size , bold letters and char.
Accepted answer
I am at a loss, why such information is not given in the initial question. If you use WCL, then WCL has a flag enforceSizeLimits, which tries to mitigate that problem and, if set, truncates the string size.
The background is, that EWM does not necessary store strings as plain strings. The text is sometimes stored as some com.ibm.team.foundation.common.text.XMLString which adds characters like tags and escape characters etc. to the string. Comments, Descriptions, .... I was not really able to find really good code how to deal with this in the client API, so I implemented the flag mentioned and that cuts the size down to an (hopefully) working size with .. Truncated at the text end. The code com.ibm.js.team.workitem.commandline.helper.WorkItemUpdateHelper.enforceSizeLimits(String, String) and com.ibm.js.team.workitem.commandline.helper.WorkItemUpdateHelper.truncateString(String, String) uses 50 bytes as XML growth constant. This might not always work, so you can modify the constant. You can try to create a more intelligent solution and use com.ibm.team.foundation.common.text.XMLString.getXMLText() or other methods to get the actual size and shrink it down.
WCL is open source and you can modify and run it on your own.
WCL is open source and you can modify and run it on your own.
Comments
Ralph Schoon
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER Feb 15 '23, 5:26 a.m.You want to show what you are doing with the string. Also tag the product as requested, versions etc, if you are interested in answers..
Akalya K
Feb 15 '23, 6:22 a.m.Akalya K
Feb 15 '23, 6:07 a.m.