You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Mike Drob (Jira)" <ji...@apache.org> on 2021/11/09 20:28:00 UTC

[jira] [Created] (LUCENE-10227) FilterPath.resolve(Path) doesn't work

Mike Drob created LUCENE-10227:
----------------------------------

             Summary: 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


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: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org