[SWS-776] Windows-specific error with relative XSD referencing Created: 21/May/12  Updated: 14/Aug/12  Resolved: 14/Aug/12

Status: Resolved
Project: Spring Web Services
Component/s: Core
Affects Version/s: 2.0.5
Fix Version/s: 2.1.1

Type: Bug Priority: Major
Reporter: Maxim Myslivtssev Assignee: Arjen Poutsma
Resolution: Cannot Reproduce Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: 0.2d
Original Estimate: Not Specified
Environment:

OS Windows


Attachments: Text File SafeClassPathResource.patch     Zip Archive path-1.0-src.zip    

 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>



 Comments   
Comment by Arjen Poutsma [ 26/Jun/12 ]

I suspect Spring-WS is not to blame, but rather Spring itself. But I've tried to reproduce this on a Windows VM, and I couldn't. I've attached a sample maven project, could you please take a look at it and see what's different from your project?

Comment by Arjen Poutsma [ 14/Aug/12 ]

Closing as Cannot Reproduce for now, due to lack of feedback.

Generated at Tue Dec 12 06:36:10 UTC 2017 using JIRA 6.4.14#64029-sha1:ae256fe0fbb912241490ff1cecfb323ea0905ca5.