[
https://issues.apache.org/jira/browse/LUCENE-10227?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17442753#comment-17442753
]
Robert Muir commented on LUCENE-10227:
--------------------------------------
I don't think we need to make a complicated exception message. This issue just
seems like a lack of understanding how the nio.2 apis work.
I would support banning all the shitty static methods with forbidden apis. One
challenge is they keep adding more shitty ones like these. For example the one
in question was added new in JDK 11.
> FilterPath.resolve(Path) doesn't work
> -------------------------------------
>
> Key: LUCENE-10227
> URL: https://issues.apache.org/jira/browse/LUCENE-10227
> Project: Lucene - Core
> Issue Type: Bug
> Reporter: Mike Drob
> Priority: Major
>
> Short reproducing sample that captures the error I encounter when trying to
> write a unit test:
> {code:java}
> package org.apache.lucene.mockfile;
> import org.apache.lucene.util.LuceneTestCase;
> import org.junit.Test;
> import java.nio.file.Path;
> public class TestFilterPath extends LuceneTestCase {
> @Test
> public void testMultiwrap() throws Exception {
> Path source = LuceneTestCase.createTempDir();
> Path child = source.resolve("child");
> assertEquals(source, child.getParent());
> child = source.resolve(Path.of("child")); // This line throws exception
> assertEquals(source, child.getParent());
> }
> }
> {code}
> When running this test (on my Mac) I get the following:
> {noformat}
> mismatch, expected: FilterPath, got: class sun.nio.fs.UnixPath
> java.nio.file.ProviderMismatchException: mismatch, expected: FilterPath, got:
> class sun.nio.fs.UnixPath
> at
> __randomizedtesting.SeedInfo.seed([318296D60FE95435:125A6A9E9053DCC3]:0)
> at org.apache.lucene.mockfile.FilterPath.toDelegate(FilterPath.java:292)
> at org.apache.lucene.mockfile.FilterPath.resolve(FilterPath.java:151)
> at
> org.apache.lucene.mockfile.TestFilterPath.testMultiwrap(TestFilterPath.java:16)
> {noformat}
> Part of the problem here might be that {{createTempDir()}} gives me a
> {{FilterPath}} wrapped four layers deep.
> Part of the problem might be that resolve calls toDelegate which is too
> strict about what it would accept?
> I'm not sure what the intent of all of these wrappings is, so I'm not
> completely sure how to fix it.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]