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

WSDLValidator through Stax2DOM leaves input streams open which causes input files to be locked.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 2.2.9
    • 2.2.10
    • Tooling
    • None
    • java version "1.6.0_20"
      Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
      Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode)

      Microsoft Windows [Version 6.0.6002]

    Description

      The WSDLValidator class leaves input stream open. This causes the validated file to be locked and it cannot be deleted, which messes up our software.

      Only when the Java process exists can the file be reclaimed. It is possible that a GC closes the file when the input stream is found and no longer reachable.

      I am invoking the WSDLValidator class programatically like this:

          private static void cxfValidateWsdl(File wsdlFile) throws Exception {
              CommandInterfaceUtils.commandCommonMain();
              ToolRunner.runTool(WSDLValidator.class, WSDLValidator.class.getResourceAsStream("wsdlvalidator.xml"), false, new String[] {
                      "-verbose", wsdlFile.toURI().toString() });
          }
      

      Down the line, CXF opens but does not close the input file stream in Stax2DOM:

          public Document getDocument(URL url) throws ToolException {
              try {
                  StreamSource src = new StreamSource(url.openStream(), url.toExternalForm());
                  return StaxUtils.read(StaxUtils.createXMLStreamReader(src), true);
              } catch (Exception e) {
                  throw new ToolException(e);
              }
          }
      

      This is fixed for all getDocument methods in the attached patch.

      I am not sure how to work around this aside from rebuilding CXF or waiting for 2.2.10.

      Attachments

        1. CXF-2900.diff
          6 kB
          ggregory@seagullsw.com

        Activity

          People

            dkulp Daniel Kulp
            ggregory Gary D. Gregory
            Votes:
            2 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: