Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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.

0 votes

Comments

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..  

Basically i am using WCL code to import csv file.
in CSV file my one of the field input is "string" value, that string byte size is 980 bytes . for calculating byte size i am using this  line of code 
" anyString.getBytes(StandardCharsets.UTF_8).length;"

but while creating jazz work item it is throwing an error like this "Value of attribute "mediumStringExtensions.value" is 1214 bytes, which is greater than the allowed encoded length of 1000 bytes."
i cant able to attach image here.




Accepted answer

Permanent link

 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.  

Akalya K selected this answer as the correct answer

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 8
× 5
× 2

Question asked: Feb 15 '23, 4:16 a.m.

Question was seen: 1,351 times

Last updated: Feb 15 '23, 6:27 a.m.

Confirmation Cancel Confirm