madrob commented on a change in pull request #207:
URL: https://github.com/apache/solr/pull/207#discussion_r667417497



##########
File path: solr/core/src/java/org/apache/solr/search/facet/UnInvertedField.java
##########
@@ -682,15 +682,16 @@ protected static void rethrowAsSolrException(String 
field, Throwable e) {
   }
 
   // Returns null if not already populated
-  @SuppressWarnings({"rawtypes", "unchecked"})
   public static UnInvertedField checkUnInvertedField(String field, 
SolrIndexSearcher searcher) throws IOException {
-    SolrCache cache = searcher.getFieldValueCache();
+    SolrCache<String, UnInvertedField> cache = searcher.getFieldValueCache();
     if (cache == null) {
       return null;
     }
     Object uif = cache.get(field);  // cache is already synchronized, so no 
extra sync needed
     // placeholder is an implementation detail, keep it hidden and return null 
if that is what we got
     return uif==uifPlaceholder || !(uif instanceof UnInvertedField)? null : 
(UnInvertedField) uif;
+    // TODO: SolrCache is not used safely in other places, but this might be 
simpligfied to:
+    //  return uif==uifPlaceholder ? null : uif;

Review comment:
       There is a lot of raw usage of SolrCache around the code, mainly around 
SolrIndexSearcher.getCache, so I wasn't confident enough in all the code paths 
not hiding any other misuse to get rid of the instances safety check.




-- 
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to