It's all about the answers!

Ask a question

Follow-up encoding problem


Timur Markunin (6495161145) | asked Oct 03 '12, 6:37 a.m.
Hello,

I'm writing follow-up that checks that wi has no blocking relationships. It works fine in my development environment but fails in client environment.

My client has JTS with Russian translation.  It looks like string that I check in my java code "Зависит от"(Depends On) is incorrectly encoded in the client environment.

Any ideas?

Comments
Alex Fitzpatrick commented Oct 03 '12, 3:56 p.m. | edited Oct 03 '12, 3:56 p.m.
JAZZ DEVELOPER

 What encoding are you using for your Java  source? (In Eclipse that is controlled in preferences General > Workspace > Text file encoding)


Timur Markunin commented Oct 03 '12, 4:29 p.m.

I use UTF-8

Accepted answer


permanent link
Ralph Schoon (58.7k23642) | answered Oct 04 '12, 8:45 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
edited Oct 04 '12, 8:47 a.m.
Timur,

that was what I meant, don't use the display names to identify anything in server extensions. There are ID's and constants available to use instead. This allows to code this up and it will work for any template. Again, see http://rsjazz.wordpress.com/2012/09/20/the-rtc-workitem-server-link-api-linking-to-work-items-and-other-elements/ and the earlier article on linking to understand how the code should be modified. E.g. use  WorkItemLinkTypes.BLOCKS_WORK_ITEM
Timur Markunin selected this answer as the correct answer

Comments
Timur Markunin commented Oct 05 '12, 5:03 a.m.

Thanks a lot, Ralph!
I've used getTargetEndPointDescriptor().getId(). It's language independent.

2 other answers



permanent link
Ralph Schoon (58.7k23642) | answered Oct 04 '12, 8:03 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Timur,

I am not sure what you do here. Are you using a string to identify the link endpoints? If so, I would suggest to use the constants to access the link types. e.g. as described here: http://rsjazz.wordpress.com/2012/09/20/the-rtc-workitem-server-link-api-linking-to-work-items-and-other-elements/

If you do this you should be independent from the language you use in the templates. I would suggest to avoid using translated strings for extensions wherever possible. Use the ID's instead. This is sometimes not easy to do, especially if coding a client that gets data as strings, but try it if possible at all.

If you do it and you still experience problems I would suggest to open a work item.

permanent link
Timur Markunin (6495161145) | answered Oct 04 '12, 8:24 a.m.
edited Oct 04 '12, 8:27 a.m.
Hi Ralph! Thanks for your response!
I'm using following code to check wi's relations:

IWorkItemReferences iwr = ((ISaveParameter) data).getNewReferences();
List<IEndPointDescriptor> epdl = iwr.getTypes();
     for(int i=0;i<epdl.size();i++)
         {
            ILinkType lt = epdl.get(i).getLinkType();
             if(lt.getLinkTypeId().endsWith(BlockingItemLink))
             {
 if(epdl.get(i).getDisplayName().equalsIgnoreCase(DependsOnLink)||epdl.get(i).getDisplayName().equalsIgnoreCase(DependsOnLinkRU))
                                {
                                    IReportInfo info = collector.createExceptionInfo("This wi is  blocked by another wi", new Throwable("Error"));
                                    // tell the caller to post an error, and reject the action
                                    collector.addInfo(info);
                                   
                                }
                            }

The problem is that if process template is translated than epdl.get(i).getDisplayName() returns translated string.

Your answer


Register or to post your answer.