You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2015/04/17 03:15:19 UTC
svn commit: r1674178 - in /lucene/dev/branches/branch_5x: ./ lucene/
lucene/core/ lucene/core/src/test/org/apache/lucene/mockfile/
lucene/test-framework/
lucene/test-framework/src/java/org/apache/lucene/mockfile/
Author: rmuir
Date: Fri Apr 17 01:15:17 2015
New Revision: 1674178
URL: http://svn.apache.org/r1674178
Log:
LUCENE-6430: fix URI delegation for non-ascii files
Modified:
lucene/dev/branches/branch_5x/ (props changed)
lucene/dev/branches/branch_5x/lucene/ (props changed)
lucene/dev/branches/branch_5x/lucene/core/ (props changed)
lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/mockfile/TestMockFilesystems.java
lucene/dev/branches/branch_5x/lucene/test-framework/ (props changed)
lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/mockfile/FilterFileSystemProvider.java
Modified: lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/mockfile/TestMockFilesystems.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/mockfile/TestMockFilesystems.java?rev=1674178&r1=1674177&r2=1674178&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/mockfile/TestMockFilesystems.java (original)
+++ lucene/dev/branches/branch_5x/lucene/core/src/test/org/apache/lucene/mockfile/TestMockFilesystems.java Fri Apr 17 01:15:17 2015
@@ -357,4 +357,20 @@ public class TestMockFilesystems extends
assertEquals(f1.hashCode(), f1Again.hashCode());
assertFalse(f1.equals(f2));
}
+
+ public void testURI() throws IOException {
+ Path dir = FilterPath.unwrap(createTempDir());
+ FileSystem fs = new FilterFileSystemProvider("test://", dir.getFileSystem()).getFileSystem(URI.create("file:///"));
+ Path wrapped = new FilterPath(dir, fs);
+
+ Path f1 = wrapped.resolve("file1");
+ URI uri = f1.toUri();
+ Path f2 = fs.provider().getPath(uri);
+ assertEquals(f1, f2);
+
+ Path f3 = wrapped.resolve("ä¸å½");
+ URI uri2 = f3.toUri();
+ Path f4 = fs.provider().getPath(uri2);
+ assertEquals(f3, f4);
+ }
}
Modified: lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/mockfile/FilterFileSystemProvider.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/mockfile/FilterFileSystemProvider.java?rev=1674178&r1=1674177&r2=1674178&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/mockfile/FilterFileSystemProvider.java (original)
+++ lucene/dev/branches/branch_5x/lucene/test-framework/src/java/org/apache/lucene/mockfile/FilterFileSystemProvider.java Fri Apr 17 01:15:17 2015
@@ -17,12 +17,10 @@ package org.apache.lucene.mockfile;
* limitations under the License.
*/
-import java.io.IOError;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URI;
-import java.net.URISyntaxException;
import java.nio.channels.AsynchronousFileChannel;
import java.nio.channels.FileChannel;
import java.nio.channels.SeekableByteChannel;
@@ -126,7 +124,7 @@ public class FilterFileSystemProvider ex
if (fileSystem == null) {
throw new IllegalStateException("subclass did not initialize singleton filesystem");
}
- Path path = delegate.getPath(toDelegate(uri));
+ Path path = delegate.getPath(uri);
return new FilterPath(path, fileSystem);
}
@@ -258,14 +256,6 @@ public class FilterFileSystemProvider ex
}
}
- private URI toDelegate(URI uri) {
- try {
- return new URI(delegate.getScheme(), uri.getSchemeSpecificPart(), uri.getFragment());
- } catch (URISyntaxException e) {
- throw new IOError(e);
- }
- }
-
/**
* Override to trigger some behavior when the filesystem is closed.
* <p>