It's all about the answers!

Ask a question

Issues while connecting to RTC from lotus notes!!


1
1
Johnson David (2611316) | asked Oct 29 '12, 1:45 p.m.

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

One answer



permanent link
Oliver Siebenmarck (1111) | answered Oct 30 '12, 10:18 a.m.
edited Oct 30 '12, 10:18 a.m.
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!


Your answer


Register or to post your answer.