Skip to content

Commit 3208410

Browse files
gabry-labturboFei
authored andcommitted
[KYUUBI #2533] Make Utils.parseURL public to remove unnecessary reflection
### _Why are the changes needed?_ make Utils.parseURL public to remove unnecessary reflection of it ### _How was this patch tested?_ - [x] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [x] Add screenshots for manual tests if appropriate - [x] [Run test](https://kyuubi.apache.org/docs/latest/develop_tools/testing.html#running-tests) locally before make a pull request Closes #2533 from gabrywu/removeReflection. Closes #2533 ed94507 [gabrywu] apply spotless plugin d4e2f1a [gabrywu] make Utils.parseURL public to remove unnecessary reflection of it Authored-by: gabrywu <gabrywu@apache.org> Signed-off-by: Fei Wang <fwang12@ebay.com>
1 parent 7612f0a commit 3208410

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/KyuubiHiveDriver.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
package org.apache.kyuubi.jdbc;
1919

2020
import java.io.IOException;
21-
import java.lang.reflect.Method;
2221
import java.net.URL;
2322
import java.sql.*;
2423
import java.util.Properties;
@@ -127,10 +126,7 @@ private Properties parseURLForPropertyInfo(String url, Properties defaults) thro
127126

128127
Utils.JdbcConnectionParams params;
129128
try {
130-
Method parseURLMethod =
131-
Utils.class.getDeclaredMethod("parseURL", String.class, Properties.class);
132-
parseURLMethod.setAccessible(true);
133-
params = (Utils.JdbcConnectionParams) parseURLMethod.invoke(null, url, defaults);
129+
params = Utils.parseURL(url, defaults);
134130
} catch (Exception e) {
135131
throw new SQLException(e);
136132
}

kyuubi-hive-jdbc/src/main/java/org/apache/kyuubi/jdbc/hive/Utils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ public static JdbcConnectionParams parseURL(String uri)
286286
* @return
287287
* @throws SQLException
288288
*/
289-
static JdbcConnectionParams parseURL(String uri, Properties info)
289+
public static JdbcConnectionParams parseURL(String uri, Properties info)
290290
throws JdbcUriParseException, SQLException, ZooKeeperHiveClientException {
291291
JdbcConnectionParams connParams = new JdbcConnectionParams();
292292

0 commit comments

Comments
 (0)