Uploaded image for project: 'Spring Web Services'
  1. Spring Web Services
  2. SWS-776

Windows-specific error with relative XSD referencing

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.0.5
    • Fix Version/s: 2.1.1
    • Component/s: Core
    • Labels:
      None
    • Environment:
      OS Windows

      Description

      It appears, that Spring ignores relative addressing in XSD files on Windows platform.

      Root cause was found at org.springframework.xml.sax.SaxUtils.getSystemId() method. It tries to construct java.net.URI object from path string with Windows-style -slashes and fails on this operation. This path string is obtained from java.net.URL.toExternalForm(). Exception is silently ignored and null is returned from the method.

      Current workaround is to implement custom org.springframework.core.io.ClassPathResource class that will override getURL() returning paths with valid /-slashes.
      Then one should use instances of this class to populate xsds property of org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection, instead of automatic Spring-generated instances.
      Patch with workaround is attached. Now XSD schema collection declaration looks like this:

      <bean class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
        <property name="xsds">
          <list>
            <bean class="com.platform.util.spring.SafeClassPathResource">
               <constructor-arg value="META-INF/xsd/service.xsd" />
            </bean>
          </list>
        </property>
      </bean>

      1. SafeClassPathResource.patch
        2 kB
        Maxim Myslivtssev

        Activity

          People

          • Assignee:
            arjen.poutsma Arjen Poutsma
            Reporter:
            desliner Maxim Myslivtssev
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - Not Specified
              Not Specified
              Remaining:
              Remaining Estimate - Not Specified
              Not Specified
              Logged:
              Time Spent - 0.2d
              0.2d