Katalon issue on update to 7.9.1

You have a comma , character in the URL. A comma is not allowed in the URL

You may say that it worked in Katalon 7.8.2. I do not know why it worked. But you should fix your problem anyway.

That is not true. Comma is reserved for use in specific circumstances in specific locations within a URI. Forward-slash and ampersand (and others) are all “reserved” yet appear in URLs frequently.

Careful examination of the complete URL would show whether or not it is being used correctly.

If you are using a comma in a non-reserved manner, you should URL encode your request (comma == %2C).

I wrote a Test Case script as follows:

String urlStr = 'https://automate.browserstack.com/s3-upload/bs-selenium-logs-********************************, selenium_logs_url=https://automate.browserstack.com/'
URL url = new URL(urlStr)

assert url.getProtocol() == "https"
assert url.getPort() == -1
assert url.getHost() == "automate.browserstack.com"
assert url.getFile() == "/s3-upload/bs-selenium-logs-********************************, selenium_logs_url=https://automate.browserstack.com/"
assert url.getPath() == "/s3-upload/bs-selenium-logs-********************************, selenium_logs_url=https://automate.browserstack.com/"
assert url.getQuery() == null

All assert statements passed. This means that java.net.URL class accepted the given String as a valid URL. So I was wrong in saying that a comma , character is not allowed in URL.

I think we should go back to the question raised by @charitos.andreou

I found that the IllegalArgumentException was raised by com.kms.katalon.core.webservice.common.DefaultHttpRequest. We can read the source code at:

Here I found a snippet:

        URI.create(uri)

java.net.URI class is used, not java.net.URL. These 2 classes may behave differently.

I wrote a Test Case script for study:

String uriStr = 'https://automate.browserstack.com/s3-upload/bs-selenium-logs-********************************, selenium_logs_url=https://automate.browserstack.com/'
URI uri = URI.create(uriStr)

When I ran it, I got:

2021-02-12 10:02:07.682 ERROR c.k.katalon.core.main.TestCaseExecutor   - ❌ Test Cases/createURI FAILED.
Reason:
java.lang.IllegalArgumentException: Illegal character in path at index 94: https://automate.browserstack.com/s3-upload/bs-selenium-logs-********************************, selenium_logs_url=https://automate.browserstack.com/
	at java_net_URI$create.call(Unknown Source)
	at createURI.run(createURI:2)
	at com.kms.katalon.core.main.ScriptEngine.run(ScriptEngine.java:194)
....

I could reproduce the problem.


But I still had a question …

Illegal character in path at index 94

What is the problematic character at index 94? Is it a ',' (comma) or a ' ' (space) just next to the ',' ?

It seemed to me that java.net.URI class disliked the ' ' (space) in the URL string, rather than ',' (comma). So I changed my study code — removed a space in URL — and found it passed.

@charitos.andreou
Could you try removing the ' ' (space) just following the , in the URL and try your test again?

Are you sure you had a ' ' (space) in the URL and it worked ok yet in Katalon 7.8.2?

I looked at the diff of versions of the com.kms.katalon.core.webservice.com.DefaultHttpRequest. I found that there was a change at 22 Dec 2020 (possibly at ver 7.9.0).

@huynguyen @duyluong @ThanhTo I could see, Katalon Team changed something about this class for some reason, about which I do not see any further. @charitos.andreou wrote: "When I load my project from Katalon 7.8.2 version to 7.9.1 I face the below issue". I think that Katalon Team should review the change made at 7.9.x. Was that change appropriate or not?

Yes am sure it run with the a space on 7.8.2, but how I will remove the space? Please find below my script.
import groovy.json.JsonSlurper as JsonSlurper import com.kms.katalon.core.testobject.TestObjectProperty as TestObjectProperty import com.kms.katalon.core.testobject.ResponseObject as ResponseObject import com.kms.katalon.core.testobject.ConditionType import com.kms.katalon.core.testobject.RequestObject as RequestObject import com.kms.katalon.core.testobject.impl.HttpTextBodyContent import static com.kms.katalon.core.checkpoint.CheckpointFactory.findCheckpoint import static com.kms.katalon.core.testcase.TestCaseFactory.findTestCase import static com.kms.katalon.core.testdata.TestDataFactory.findTestData import static com.kms.katalon.core.testobject.ObjectRepository.findTestObject import static com.kms.katalon.core.testobject.ObjectRepository.findWindowsObject import com.kms.katalon.core.checkpoint.Checkpoint as Checkpoint import com.kms.katalon.core.cucumber.keyword.CucumberBuiltinKeywords as CucumberKW import com.kms.katalon.core.mobile.keyword.MobileBuiltInKeywords as Mobile import com.kms.katalon.core.model.FailureHandling as FailureHandling import com.kms.katalon.core.testcase.TestCase as TestCase import com.kms.katalon.core.testdata.TestData as TestData import com.kms.katalon.core.testng.keyword.TestNGBuiltinKeywords as TestNGKW import com.kms.katalon.core.testobject.TestObject as TestObject import com.kms.katalon.core.webservice.keyword.WSBuiltInKeywords as WS import com.kms.katalon.core.webui.keyword.WebUiBuiltInKeywords as WebUI import com.kms.katalon.core.windows.keyword.WindowsBuiltinKeywords as Windows import internal.GlobalVariable as GlobalVariable import com.kms.katalon.core.testobject.ResponseObject as ResponseObject import org.junit.After import org.openqa.selenium.By as By import org.openqa.selenium.WebDriver as WebDriver import org.openqa.selenium.WebElement as WebElement

JsonSlurper slurper = new JsonSlurper()
RequestObject ro = new RequestObject('a')
ro.setRestRequestMethod('GET')
ro.setRestUrl(GlobalVariable.networkLogURL)
System.out.println(">>> networkLogURL=" + GlobalVariable.networkLogURL);
def httpheader = new ArrayList<TestObjectProperty>()
httpheader.add(new TestObjectProperty( 'Content-Type', ConditionType.EQUALS, 'application/json'))

ro.setHttpHeaderProperties(httpheader)

ResponseObject response = WS.sendRequest(ro)
def response_array = slurper.parseText(response.getResponseText())

Please do not ask this question to others.

It’s only you who can see your project.

sorry for that but I found out the difference on what happen between 7.8.2 version with 7.9 and above.

It was about com.kms.katalon.core.webservice.com.DefaultHttpRequest

I was receiving the https on different order. So I trim the the link where I want it after my inspection.