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

Issues while connecting to RTC from lotus notes!!

Hello Guys,

Here is my problem!! I am trying to connect to RTC from lotus notes java agent. I have an string called "ABC Apps" and i use the below code to create an java.net.URI object, it works fine!!

String projectAreaName="ABC Apps";
java.net.URI uri= java.net.URI.create(projectAreaName.replaceAll(" ", "%20"));
IProjectArea projectArea= (IProjectArea) processClient.findProcessArea(uri, null, null);
  System.out.println("project area"+projectArea);
  
  if (projectArea == null) {
   status_msg= status_msg + "Project area not found." +eol;
   System.out.println("Project area not found.");   
  }

But its not able to parse the below string with special characters

String projectAreaName="ABC & Systems Management, Level 2 & Support (eXYZ)";
java.net.URI uri= java.net.URI.create(projectAreaName.replaceAll(" ","%20"));

Getting an error saying "Project area not found"

Can someone please help me to get rid off this problem ?

Thank you!!!

1

1 vote



One answer

Permanent link
Hi,

I believe your problem might stem from the ampersand & and brackets (), as they are special characters in an URI and need to be escaped. You already do this with the spaces in the project area name by replacing them with "%20".

Thankfully, Java has an easy solution for you, so you do not have to do all the encoding yourself. You could try the following:

String projectAreaName = "ABC & Systems Management, Level 2 & Support (eXYZ)";
java.net.URI uri= java.net.URI.create(URLEncoder.encode(projectAreaName  , "utf-8" ));

Hope that helps!


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
× 10,940

Question asked: Oct 29 '12, 1:45 p.m.

Question was seen: 4,693 times

Last updated: Oct 30 '12, 10:18 a.m.

Confirmation Cancel Confirm