mszurap commented on code in PR #5701:
URL: https://github.com/apache/hive/pull/5701#discussion_r2306707185
##########
beeline/src/java/org/apache/hive/beeline/BeeLine.java:
##########
@@ -900,6 +900,8 @@ private boolean connectUsingArgs(BeelineParser
beelineParser, CommandLine cl) {
getOpts().setScriptFile(cl.getOptionValue("f"));
if (url != null) {
+ //remove white spaces in the URL in case there is any, like in
"jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS_LIST=..."
Review Comment:
@nrg4878 let's say we do not replace all the spaces, but only those before
the semicolon or question mark or hashtag (special characters are `;?#`) Like
```
if (url != null) {
url = removeSpacesFromURLBeforeFirstSpecialChar(url);
```
Then we need to adjust the test code to the below, which shows the problem
with the spaces in the url: this will cause the command line arguments to be
skewed:
```
String args2[] = new String[] {"-u", "url with space;pw=Pw with spaces",
"-n", "name",
"-p", "password", "-d", "driver", "-a", "authType"};
org.junit.Assert.assertEquals(0, bl.initArgs(args2));
Assert.assertTrue(bl.connectArgs.equals("urlwithspace;pw=Pw with spaces
name password driver"));
Assert.assertTrue(bl.getOpts().getAuthType().equals("authType"));
```
the "with" becomes the username, "spaces" becomes the password, "name"
becomes the driver.
This would happen even right now, in the current Hive code if someone would
use spaces anywhere in the URL.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]