Reamer commented on code in PR #4926:
URL: https://github.com/apache/zeppelin/pull/4926#discussion_r2068498260
##########
zeppelin-server/src/main/java/org/apache/zeppelin/service/ShiroAuthenticationService.java:
##########
@@ -443,11 +464,12 @@ private List<String> getUserList(JdbcRealm obj) {
try {
con = dataSource.getConnection();
ps = con.prepareStatement(userquery);
- ps.setString(1, username);
- ps.setString(2, tablename);
+ ps.setString(1, "%" + searchText + "%");
rs = ps.executeQuery();
- while (rs.next()) {
+ int count = 0;
Review Comment:
Why the `count`?
##########
zeppelin-server/src/main/java/org/apache/zeppelin/service/ShiroAuthenticationService.java:
##########
@@ -415,26 +423,39 @@ private List<String> getUserList(JdbcRealm obj) {
try {
dataSource = (DataSource) FieldUtils.readField(obj, "dataSource", true);
authQuery = (String) FieldUtils.readField(obj, "authenticationQuery",
true);
- LOGGER.info(authQuery);
+ LOGGER.debug("authenticationQuery={}", authQuery);
String authQueryLowerCase = authQuery.toLowerCase();
retval = authQueryLowerCase.split("from", 2);
if (retval.length >= 2) {
retval = retval[1].split("with|where", 2);
- tablename = retval[0];
+ tablename = retval[0].trim();
retval = retval[1].split("where", 2);
if (retval.length >= 2) {
retval = retval[1].split("=", 2);
} else {
retval = retval[0].split("=", 2);
}
- username = retval[0];
+ username = retval[0].trim();
Review Comment:
```suggestion
username = retval[0].strip();
```
##########
zeppelin-server/src/main/java/org/apache/zeppelin/service/ShiroAuthenticationService.java:
##########
@@ -415,26 +423,39 @@ private List<String> getUserList(JdbcRealm obj) {
try {
dataSource = (DataSource) FieldUtils.readField(obj, "dataSource", true);
authQuery = (String) FieldUtils.readField(obj, "authenticationQuery",
true);
- LOGGER.info(authQuery);
+ LOGGER.debug("authenticationQuery={}", authQuery);
String authQueryLowerCase = authQuery.toLowerCase();
retval = authQueryLowerCase.split("from", 2);
if (retval.length >= 2) {
retval = retval[1].split("with|where", 2);
- tablename = retval[0];
+ tablename = retval[0].trim();
Review Comment:
Just a little thing.
Meanwhile, I would use `strip()` because this method is Unicode aware. What
do you think?
```suggestion
tablename = retval[0].strip();
```
--
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]