uschindler commented on code in PR #868:
URL: https://github.com/apache/lucene/pull/868#discussion_r866664382


##########
lucene/analysis/kuromoji/src/java/org/apache/lucene/analysis/ja/dict/BinaryDictionary.java:
##########
@@ -140,19 +140,15 @@ public static final InputStream 
getResource(ResourceScheme scheme, String path)
       throws IOException {
     switch (scheme) {
       case CLASSPATH:
-        return getClassResource(path);
+        return IOUtils.requireResourceNonNull(
+            BinaryDictionary.class.getClassLoader().getResourceAsStream(path), 
path);

Review Comment:
   Oh ja, this is one of the horrible parts in the code which made API 
inconsistent. This replace is only in ConnectionCosts, nowhere else. The idea 
was some of those many "convenience" ideas splattered through this code in 
inconsistent ways. It looks like the path argument could be a class name 
instead of a path name and this converts it. I think nobody used this and it is 
a relic from earlier times overseen when we rewrote the code in 2012.
   
   Reading @msokolov code in the issue i think the current "limited" backwards 
layer covers all usage.
   
   And for no longer supported things like passing null together with 
`CLASSPATH` type, I changed the code to throw NPE with text: "please use 
default constrcutor".



-- 
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: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to