-
Bug
-
Resolution: Fixed
-
P3
-
7
-
b128
-
generic
-
generic
-
Verified
JDK version: 7-pro-b123
The following code and output show ZipPath.normalize("/./.") returns null while the Path on default file system returns "/./.".
Although the Path.normalize() is implementation dependent, null for "/./." seems not a reasonalbe return value anyway.
=====Begin of Code=====
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
import com.sun.nio.zipfs.ZipFileSystem;
import static java.lang.System.out;
public class Normalize {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
Map<String, Object> env = new HashMap<String, Object>();
env.put("create", "true");
Path file = Paths.get("place_holder.zip");
file.deleteIfExists();
ZipFileSystem fs = (ZipFileSystem) FileSystems.newFileSystem(file, env,
null);
String path = "/./.";
out.println();
out.println("path to be normalized: " + path);
out.println(Paths.get(path));
out.println(fs.getPath(path).normalize());
}
}
=====End of Code=====
=====Begin of Output=====
path to be normalized: /./.
\.\.
null
=====End of Output=====
The following code and output show ZipPath.normalize("/./.") returns null while the Path on default file system returns "/./.".
Although the Path.normalize() is implementation dependent, null for "/./." seems not a reasonalbe return value anyway.
=====Begin of Code=====
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
import com.sun.nio.zipfs.ZipFileSystem;
import static java.lang.System.out;
public class Normalize {
/**
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
Map<String, Object> env = new HashMap<String, Object>();
env.put("create", "true");
Path file = Paths.get("place_holder.zip");
file.deleteIfExists();
ZipFileSystem fs = (ZipFileSystem) FileSystems.newFileSystem(file, env,
null);
String path = "/./.";
out.println();
out.println("path to be normalized: " + path);
out.println(Paths.get(path));
out.println(fs.getPath(path).normalize());
}
}
=====End of Code=====
=====Begin of Output=====
path to be normalized: /./.
\.\.
null
=====End of Output=====