-
Notifications
You must be signed in to change notification settings - Fork 609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Impala Jdbc URL (including schema without properties) parsing exception #644
Conversation
@@ -99,7 +102,7 @@ public ConnectionInfo parse() { | |||
} else { | |||
String[] hostAndPort = hostSegment[0].split(":"); | |||
if (hostAndPort.length != 1) { | |||
return new ConnectionInfo(component, DB_TYPE, hostAndPort[0], Integer.valueOf(hostAndPort[1]), fetchDatabaseNameFromURL(location | |||
return new ConnectionInfo(component, DB_TYPE, hostAndPort[0], Integer.parseInt(hostAndPort[1]), fetchDatabaseNameFromURL(location |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain why change this method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ConnectionInfo's param port
need type int not Integer, whether Integer.parseInt
is better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My question is why do you use parseInt insteads of valueOf.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see the ConnectionInfo's port need type int
, so Integer.parseInt
is enough, and Integer.valueOf
(Integer.valueOf(parseInt()) here return Integer
may be unnecessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert Integer .valueOf
changes, and fix impala url parse exception only first.
CI fails as you don't follow the code style
The code style file is in the root, and you should run maven verify on your local side. |
Got it! |
Fix Impala Jdbc URL (including schema without properties) parsing exception
Add a unit test to verify that the fix works.
Explain briefly why the bug exists and how to fix it.
When set up Impala jdbc url like
jdbc:impala://localhost:21050/test
without properties behind, it may cause exceptionjava.lang.NumberFormatException: For input string: "21050/test"
. To avoid conversion exceptions, optimized the positioning of URL params.Update the
CHANGES
log.