You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ranger.apache.org by "Qiang Zhang (JIRA)" <ji...@apache.org> on 2017/02/28 03:11:45 UTC

[jira] [Commented] (RANGER-1399) Do some code improvement in Java method SolrUtil.searchResources

    [ https://issues.apache.org/jira/browse/RANGER-1399?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15887147#comment-15887147 ] 

Qiang Zhang commented on RANGER-1399:
-------------------------------------

[~coheigea], I accidentally closed the RR. Now I reopened it. After the issue was resolved, I'll close it again. Thanks.

> 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
>              Labels: patch
>         Attachments: 0001-RANGER-1399-Do-some-code-improvement-in-Java-method-.patch
>
>   Original Estimate: 12h
>  Remaining Estimate: 12h
>
> 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)