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

How can I distinguish between a name and UUID?

I'm working on a script that uses the RTC CLI to access RTC in which a user can reference an RTC object by either its name or its UUID.  How can I determine if the user referenced the object by name or UUID.  Can I take the object reference to be UUID if and only if it begins with an underscore?

0 votes


Accepted answer

Permanent link

If you have access to the RTC plain-Java API, you can call com.ibm.team.repository.common.UUID.valueOf(userSuppliedValue), and if that call throws an IllegalArgumentException, then it was not a valid UUID (that's the main fool proof way).
(but yes, a UUID is 22 characters long and starts with an _  , but just keep in mind it's always possible for a crazy user to have a stream name start with an underscore and happen to also be 22 characters long)




Geoff Alexander selected this answer as the correct answer

1 vote

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
× 12,019
× 21
× 9

Question asked: Sep 29 '20, 3:04 p.m.

Question was seen: 1,227 times

Last updated: Oct 08 '20, 8:21 p.m.

Confirmation Cancel Confirm