From 3a017e4cf2641ca2b0e9861f3ce915c2d2308c74 Mon Sep 17 00:00:00 2001 From: Christine Poerschke Date: Fri, 23 Jun 2017 11:12:29 +0100 Subject: [PATCH] SOLR-10778: eliminate local variables in (PageTool,AnalyzeEvaluator,ClassifyStream) --- .../velocity/src/java/org/apache/solr/response/PageTool.java | 5 ++--- .../src/java/org/apache/solr/handler/AnalyzeEvaluator.java | 3 +-- .../src/java/org/apache/solr/handler/ClassifyStream.java | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/solr/contrib/velocity/src/java/org/apache/solr/response/PageTool.java b/solr/contrib/velocity/src/java/org/apache/solr/response/PageTool.java index 48dc82619e8..193c89b0ecd 100644 --- a/solr/contrib/velocity/src/java/org/apache/solr/response/PageTool.java +++ b/solr/contrib/velocity/src/java/org/apache/solr/response/PageTool.java @@ -44,9 +44,8 @@ public class PageTool { Object docs = response.getResponse(); if (docs != null) { if (docs instanceof DocSlice) { - DocSlice doc_slice = (DocSlice) docs; - results_found = doc_slice.matches(); - start = doc_slice.offset(); + results_found = ((DocSlice) docs).matches(); + start = ((DocSlice) docs).offset(); } else if(docs instanceof ResultContext) { DocList dl = ((ResultContext) docs).getDocList(); results_found = dl.matches(); diff --git a/solr/core/src/java/org/apache/solr/handler/AnalyzeEvaluator.java b/solr/core/src/java/org/apache/solr/handler/AnalyzeEvaluator.java index 7c7349893f8..d5bc70dc546 100644 --- a/solr/core/src/java/org/apache/solr/handler/AnalyzeEvaluator.java +++ b/solr/core/src/java/org/apache/solr/handler/AnalyzeEvaluator.java @@ -59,9 +59,8 @@ public class AnalyzeEvaluator extends SimpleEvaluator { if (solrCoreObj == null || !(solrCoreObj instanceof SolrCore) ) { throw new SolrException(SolrException.ErrorCode.INVALID_STATE, "StreamContext must have SolrCore in solr-core key"); } - SolrCore solrCore = (SolrCore) solrCoreObj; - analyzer = solrCore.getLatestSchema().getFieldType(analyzerField).getIndexAnalyzer(); + analyzer = ((SolrCore) solrCoreObj).getLatestSchema().getFieldType(analyzerField).getIndexAnalyzer(); } private void init(String fieldName, String analyzerField) { diff --git a/solr/core/src/java/org/apache/solr/handler/ClassifyStream.java b/solr/core/src/java/org/apache/solr/handler/ClassifyStream.java index 1c266856f15..b4b0669a56a 100644 --- a/solr/core/src/java/org/apache/solr/handler/ClassifyStream.java +++ b/solr/core/src/java/org/apache/solr/handler/ClassifyStream.java @@ -85,8 +85,7 @@ public class ClassifyStream extends TupleStream implements Expressible { if (solrCoreObj == null || !(solrCoreObj instanceof SolrCore) ) { throw new SolrException(SolrException.ErrorCode.INVALID_STATE, "StreamContext must have SolrCore in solr-core key"); } - SolrCore solrCore = (SolrCore) solrCoreObj; - analyzer = solrCore.getLatestSchema().getFieldType(analyzerField).getIndexAnalyzer(); + analyzer = ((SolrCore) solrCoreObj).getLatestSchema().getFieldType(analyzerField).getIndexAnalyzer(); this.docStream.setStreamContext(context); this.modelStream.setStreamContext(context);