Qiang Zhang created RANGER-1399:
-----------------------------------
Summary: Do some code improvement in Java method
SolrUtil.searchResources
Key: RANGER-1399
URL: https://issues.apache.org/jira/browse/RANGER-1399
Project: Ranger
Issue Type: Improvement
Components: admin
Reporter: Qiang Zhang
Assignee: Qiang Zhang
Priority: Minor
In method searchResources of class
/security-admin-web/src/main/java/org/apache/ranger/solr/SolrUtil.java,
there is some code can be improved:
1.There is spelling error, "Search file" should be "Search field"
{code}
logger.error("Search file is not of java object instanceof Date");
{code}
2.use "query" to replace "query.toString()" when print log
{code}
if (logger.isDebugEnabled()) {
logger.debug("SOLR QUERY=" + query.toString());
}
if (response == null || response.getStatus() != 0) {
logger.error("Error running query. query=" + query.toString()
+ ", response=" + response);
throw restErrorUtil.createRESTException("Error running query",
MessageEnums.ERROR_SYSTEM);
}
{code}
3.In Java method SolrAccessAuditsService.searchXAccessAudits, there is
duplicate code to check response, in fact it would never be called, because
response has been checked before returning in SolrUtil.searchResources, so
remove it
{code}
if (response == null) {
logger.warn("Error running search query. searchCriteria="
+ searchCriteria.toString());
throw restErrorUtil.createRESTException(
"Error running search query",
MessageEnums.ERROR_SYSTEM);
}
{code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)