Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2476

java.nio.file.ProviderMismatchException when using application-scope-injected java.nio.Path

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • 2.3.5.Final
    • None
    • None

    Description

      We are injecting a `java.nio.Path` object into some bean as a class field, say `rootPath`. The injected Path object is then used as follows

      java.nio.files.Files.createDirectories(rootPath)
      

      This leads to a `java.nio.file.ProviderMismatchException` when the producer of the path object additionally declares `@ApplicationScoped`. Further debugging shows that in this case the path instance is a WELD proxy: `Comparable$Iterable$Path$Watchable$538699755$Proxy$_$$_WeldClientProxy`.

      However, the code works without declaring `@ApplicationScoped` for the producer. In this case the path instance is a `sun.nio.fs.UnixPath` and the statement above does not throw the exception.

      This seems to be related to this question on Stackoverflow. Seems that the proxy somehow interferes with the provider.

      Attachments

        Activity

          People

            Unassigned Unassigned
            twwwt Thorsten Möller (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: