Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8314561

(zipfs) ZipPath.compareTo throws ProviderMismatchException instead of CCE

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      The javadoc for java.nio.file.Path.compareTo says that "if the paths are associated with different providers", the method throws a ClassCastException, but jdk.nio.zipfs.ZipPath.compareTo throws ProviderMismatchException instead.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1. Create a FileSystem for a zip/jar file via FileSystems.newFileSystem
      2. Get a path, any path, from the zip fs
      3. Get a path, any path, from the default FileSystem
      4. Call compareTo on the Path from the zip fs with the Path from the default fs as argument

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Comparison throws a ClassCastException
      ACTUAL -
      Comparison throws a ProviderMismatchException

      FREQUENCY : always


            lancea Lance Andersen
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: