It's all about the answers!

Ask a question

RTC Change Set Constraints


Marko Tomljenovic (31650109) | asked Oct 26 '18, 5:02 a.m.
Hello,
are there any size, character constraints for change set comments?

In addition in the Eclipse editor I can give a comment that is having line breaks between the different parts of the text. But when I afterwards look at the comment in the client it ignores these line breaks.
Are these line breaks not saved at all or are they just not shown?

Background is that we are writing a tool that checks in/delivers change sets via RTC 6.0.6 Plain Java API and we want to handle such corner cases properly.

Thank you

One answer



permanent link
David Lafreniere (4.8k7) | answered Oct 29 '18, 2:32 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
edited Oct 29 '18, 2:37 p.m.

Like anything stored in the DB there certainly is a size limit. I see the model object for an IChangeSet comment has a 'dbStringSize=LARGE', from ItemUtil we see LARGE_STRING_BYTES = 32768, so that's the max number of bytes the comment can take up using UTF-8 encoding (there's no specific character restrictions which was your other question, as long as your string can be encoded using UTF-8 as expected). There is also API to tell you if the string is too long using:


IHelperType helperType = IHelperType.IRegistry.INSTANCE.getHelperType(
                ScmPackage.eINSTANCE.getChangeSet().getName(), ScmPackage.eNS_URI);
String propertyName = ScmPackage.eINSTANCE.getChangeSet_Comment().getName();
IItemValidator.INSTANCE.validateAttribute(helperType , propertyName, value);

When computing the bytes, recall that each character could take up either 1, 2 or 3 bytes. So you would want to check that using a method such as:

    /
     * Returns the number of bytes needed to represent the char in a UTF-8
     * encoding.
     * @param ch
    
            the char to measure
     * @return the number of bytes needed in UTF-8 encoding
    
/
    private static int getUtf8ByteLength(char ch) {
        if ((ch & 0xFF80) == 0) {
            return 1;
        } else if ((ch & 0xF800) == 0) {
            return 2;
        } else {
            return 3;
        }
    }

Also, to answer your other question, new line characters are NOT removed when saving to the database... we just end up removing them in the UI to make it more readable on a single row (for the change set label itself)

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.