Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-8411

Improve FastInfoset interceptors' compatibility with GraalVM native compilation

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.4.2
    • 3.5.0, 3.4.3, 3.3.10
    • Core
    • Novice

    Description

      The FastInfoset jar is an optional dependency of CXF which means most applications will not have it on their classpath. When that is the case, the GraalVM native compilation of FIStaxInInterceptor and FIStaxOutInterceptor will fail. That in itself is not a big deal as it would be trivial to apply some substitutions however, the fact that the two interceptors use classes from FastInfoset in the return values of some of their methods makes them impossible to substitute.

      The two offending methods are:
      FIStaxInInterceptor -> private StAXDocumentParser getParser(InputStream in)
      FIStaxOutInterceptor -> private StAXDocumentSerializer getOutput(OutputStream out)

      I suggest replacing the FastInfoset classes in the return values with the appropriate StAX interfaces: XMLStreamReader and XMLStreamWriter respectively. There's also a variable in FIStaxOutInterceptor whose type could be changed in the same way. These few changes would make the two interceptors trivial to substitute when FastInfoset is not present at native compilation time.

      If there's interest in this change, I can offer a PR pretty quickly.

      An alternative to these changes could be to turn the FastInfoset support into an extension which could then be disabled during native compilation. However, the implications of that kind of change are not something I can properly appreciate with my limited knowledge of the CXF codebase.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              bnazare Bruno Gonçalves
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: