You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2022/04/20 02:07:13 UTC

[GitHub] [lucene] rmuir opened a new pull request, #822: LUCENE-10526: add single method to mockfile to wrap a Path

rmuir opened a new pull request, #822:
URL: https://github.com/apache/lucene/pull/822

   Currently "new FilterPath" is called from everywhere, making it impossible for a mockfilesystem to use a custom subclass.
   
   See JIRA for full description.
   
   The use case here is to e.g. allow WindowsFS to wrap with a custom subclass that checks for special characters that windows doesn't allow. But today it can't do that since there is code everywhere doing the wrapping.
   
   This PR adds a single method `wrapPath()` to FilterFileSystemProvider to do this wrapping, and refactors everything to use it.
   


-- 
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-unsubscribe@lucene.apache.org

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


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


[GitHub] [lucene] gautamworah96 commented on a diff in pull request #822: LUCENE-10526: add single method to mockfile to wrap a Path

Posted by GitBox <gi...@apache.org>.
gautamworah96 commented on code in PR #822:
URL: https://github.com/apache/lucene/pull/822#discussion_r854391999


##########
lucene/test-framework/src/java/org/apache/lucene/tests/mockfile/FilterFileSystemProvider.java:
##########
@@ -116,7 +116,11 @@ public Path getPath(URI uri) {
     if (fileSystem == null) {
       throw new IllegalStateException("subclass did not initialize singleton filesystem");
     }
-    Path path = delegate.getPath(uri);
+    return wrapPath(delegate.getPath(uri), fileSystem);
+  }
+
+  /** wraps a Path with provider-specific behavior */
+  public FilterPath wrapPath(Path path, FileSystem filesystem) {

Review Comment:
   nit: The `filesystem` param is redundant here (the global one is being used in the FilterPath call).



-- 
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-unsubscribe@lucene.apache.org

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


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


[GitHub] [lucene] rmuir commented on a diff in pull request #822: LUCENE-10526: add single method to mockfile to wrap a Path

Posted by GitBox <gi...@apache.org>.
rmuir commented on code in PR #822:
URL: https://github.com/apache/lucene/pull/822#discussion_r854435033


##########
lucene/test-framework/src/java/org/apache/lucene/tests/mockfile/FilterFileSystemProvider.java:
##########
@@ -116,7 +116,11 @@ public Path getPath(URI uri) {
     if (fileSystem == null) {
       throw new IllegalStateException("subclass did not initialize singleton filesystem");
     }
-    Path path = delegate.getPath(uri);
+    return wrapPath(delegate.getPath(uri), fileSystem);
+  }
+
+  /** wraps a Path with provider-specific behavior */
+  public FilterPath wrapPath(Path path, FileSystem filesystem) {

Review Comment:
   thank you @gautamworah96 
   I will investigate and see if we can simplify this. 



-- 
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-unsubscribe@lucene.apache.org

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


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


[GitHub] [lucene] rmuir merged pull request #822: LUCENE-10526: add single method to mockfile to wrap a Path

Posted by GitBox <gi...@apache.org>.
rmuir merged PR #822:
URL: https://github.com/apache/lucene/pull/822


-- 
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-unsubscribe@lucene.apache.org

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


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


[GitHub] [lucene] rmuir commented on pull request #822: LUCENE-10526: add single method to mockfile to wrap a Path

Posted by GitBox <gi...@apache.org>.
rmuir commented on PR #822:
URL: https://github.com/apache/lucene/pull/822#issuecomment-1104430915

   Thanks for reviewing, and good luck improving the act-like-Windows!


-- 
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-unsubscribe@lucene.apache.org

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


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


[GitHub] [lucene] rmuir commented on pull request #822: LUCENE-10526: add single method to mockfile to wrap a Path

Posted by GitBox <gi...@apache.org>.
rmuir commented on PR #822:
URL: https://github.com/apache/lucene/pull/822#issuecomment-1104369976

   @gautamworah96 care to take another look? I think fixing the tiny nit was helpful to our tests. now it is easier for tests to wrap a path with one of these mock filesystems explicitly, as they don't have to deal with URI class or pass around FileSystem objects. thanks!


-- 
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-unsubscribe@lucene.apache.org

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


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