test/jdk/nio/zipfs/PathOps.java

Print this page




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.nio.file.*;
  25 import java.net.*;
  26 import java.util.*;
  27 import java.io.IOException;
  28 
  29 /**
  30  * Tests path operations for zip provider.



  31  */
  32 
  33 public class PathOps {
  34 
  35     static final java.io.PrintStream out = System.out;
  36     static FileSystem fs;
  37 
  38     private String input;
  39     private Path path;
  40     private Exception exc;
  41 
  42     private PathOps(String s) {
  43         out.println();
  44         input = s;
  45         try {
  46             path = fs.getPath(s);
  47             out.format("%s -> %s", s, path);
  48         } catch (Exception x) {
  49             exc = x;
  50             out.format("%s -> %s", s, x);


 430             path.compareTo(null);
 431             throw new RuntimeException("NullPointerException not thrown");
 432         } catch (NullPointerException npe) {
 433         }
 434 
 435         try {
 436             path.startsWith((Path)null);
 437             throw new RuntimeException("NullPointerException not thrown");
 438         } catch (NullPointerException npe) {
 439         }
 440 
 441         try {
 442             path.endsWith((Path)null);
 443             throw new RuntimeException("NullPointerException not thrown");
 444         } catch (NullPointerException npe) {
 445         }
 446 
 447     }
 448 
 449     public static void main(String[] args) throws Throwable {
 450 
 451         Path zipfile = Paths.get(args[0]);
 452         fs = FileSystems.newFileSystem(zipfile, null);
 453         npes();
 454         doPathOpTests();
 455         fs.close();
 456     }
 457 }


  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 import java.nio.file.*;
  25 import java.net.*;
  26 import java.util.*;
  27 import java.io.IOException;
  28 
  29 /**
  30  *
  31  * @test
  32  * @bug 8038500
  33  * @summary Tests path operations for zip provider.
  34  */
  35 
  36 public class PathOps {
  37 
  38     static final java.io.PrintStream out = System.out;
  39     static FileSystem fs;
  40 
  41     private String input;
  42     private Path path;
  43     private Exception exc;
  44 
  45     private PathOps(String s) {
  46         out.println();
  47         input = s;
  48         try {
  49             path = fs.getPath(s);
  50             out.format("%s -> %s", s, path);
  51         } catch (Exception x) {
  52             exc = x;
  53             out.format("%s -> %s", s, x);


 433             path.compareTo(null);
 434             throw new RuntimeException("NullPointerException not thrown");
 435         } catch (NullPointerException npe) {
 436         }
 437 
 438         try {
 439             path.startsWith((Path)null);
 440             throw new RuntimeException("NullPointerException not thrown");
 441         } catch (NullPointerException npe) {
 442         }
 443 
 444         try {
 445             path.endsWith((Path)null);
 446             throw new RuntimeException("NullPointerException not thrown");
 447         } catch (NullPointerException npe) {
 448         }
 449 
 450     }
 451 
 452     public static void main(String[] args) throws Throwable {
 453         Path zipfile = Paths.get(System.getProperty("test.jdk"),
 454                                  "jre/lib/ext/zipfs.jar");
 455         fs = FileSystems.newFileSystem(zipfile, null);
 456         npes();
 457         doPathOpTests();
 458         fs.close();
 459     }
 460 }