zipfs and relative paths
Joel Uckelman
uckelman at nomic.net
Sun Nov 29 10:00:42 PST 2009
Thus spake Joel Uckelman:
>
> Here's two more zipfs patches:
>
> * Simplified subpath(). (This was overcomplex.)
> * normalize() now returns null for paths equivalent to "."
>
And one more:
* Cannot relativize() when exactly one path is absolute.
I think all of the methods which manipulate Paths work now.
-------------- next part --------------
# HG changeset patch
# User Joel Uckelman <uckelman at nomic.net>
# Date 1259513221 -3600
# Node ID 46fe5da2beaaee6f28f02dfcb673725b4df7c4b5
# Parent d5401dc6df718abde155439521ee5a5fd9090b6c
Cannot relativize() when exactly one path is absolute.
diff --git a/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFilePath.java b/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFilePath.java
--- a/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFilePath.java
+++ b/src/share/demo/nio/ZipFileSystem/com/sun/nio/zipfs/ZipFilePath.java
@@ -514,8 +514,9 @@
if (otherPath.equals(this)) {
return null;
}
+
if (this.isAbsolute() != otherPath.isAbsolute()) {
- return otherPath;
+ throw new IllegalArgumentException();
}
int i = 0;
More information about the nio-dev
mailing list