zipfs resolve() patch

Joel Uckelman uckelman at nomic.net
Fri Nov 6 10:51:34 PST 2009


Here's another patch for zipfs: According to the javadoc, Path.resolve()
should return this when other == null, but ZipFilePath.resolve() doesn't.

-------------- next part --------------
# HG changeset patch
# User uckelman at adsl-208-39.dsl.uva.nl
# Date 1257533093 -3600
# Node ID 9adf7b9c8a7c67959d398cc7ebf73db271031833
# Parent  da6c4e140924f13a4e63f11b859ca8acf972e2cb
Docs require resolve() to return this when other == null.

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
@@ -558,13 +558,15 @@
     }
 
     public ZipFilePath resolve(Path other) {
-        // zip/jar path are always absolute
         if (other == null) {
-            throw new NullPointerException();
+            return this;
         }
+
         if (!(other instanceof ZipFilePath)) {
             throw new ProviderMismatchException();
         }
+
+        // zip/jar path are always absolute
         ZipFilePath other1 = (ZipFilePath) other;
         if (other1.isAbsolute()) {
             return other1;


More information about the nio-dev mailing list