Home > OS >  java.lang.IllegalArgumentException :Invalid uri
java.lang.IllegalArgumentException :Invalid uri

Time:12-21

I am trying GET response for an uri but everytime i get is error message "Invalid uri" Here is what i tried out(Code snippet) :

String sAttachURL = "https://rt4.de.company.com/gx/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Electric_TM/executionworkitem?fields=feed/entry/content/executionworkitem/testplan[@href=\"rt4.de.company.com/gx/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Electric_TM/testplan/urn:com.ibm.rqm:testplan:27\"]";
GetMethod method = new GetMethod(sAttachURL);

Here also if i hit the same url in RESTClient, response is coming properly also if try triggering something like this :

String sAttachURLService = "https://rt4.de.company.com/gx/service";
GetMethod method = new GetMethod(sAttachURLService);

Response is coming properly via my code but only for sAttachURL its throws error not sure why i also feel [ ] brackets here might possible be causing some issue while encoding not sure Can anyone please help me out here

Thank you

CodePudding user response:

Have you tried to percent-encode your brackets ? [ for [ and ] for ], so in your case :

String sAttachURL = "https://rt4.de.company.com/gx/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Electric_TM/executionworkitem?fields=feed/entry/content/executionworkitem/testplan[@href=\"rt4.de.company.com/gx/service/com.ibm.rqm.integration.service.IIntegrationService/resources/Electric_TM/testplan/urn:com.ibm.rqm:testplan:27\"]";
  • Related