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

Uwe Schindler commented on LUCENE-10335:
----------------------------------------

Hi Dawid,
thanks for the patch. Actually the Supplier isn't needed (if we call the method 
before we get the reader), but then we have 2 methods with same signature.

I was thinking the whole night about it and I will do the following:
- Apply your patch for deprecation, but I will make the deprecated method throw 
Exception when used in module mode. We can't remove it because third party 
analyzer packages may use it.
- Rewrite all calling code to use try-with-resources (as it allows NULL)
- For the NULL Exception I will add a wrapper method like 
Objects.requireNonNull() but that throws an IOException. I will document it as 
"workaround" for Class#getResourceAsStream()

I will open PR soon.

> IOUtils.getDecodingReader(Class<?>, String) is broken with modules
> ------------------------------------------------------------------
>
>                 Key: LUCENE-10335
>                 URL: https://issues.apache.org/jira/browse/LUCENE-10335
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Dawid Weiss
>            Priority: Major
>         Attachments: LUCENE-10335-1.patch, LUCENE-10335.patch
>
>
> This method calls clazz.getResourceAsStream() but in a modular application 
> the method won't see any of the resources in clazz's module, causing an NPE. 
> We should deprecate or even remove this method entirely, leaving only 
> getDecodingReader(InputStream) and opening the resource on the caller's side.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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

Reply via email to