[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

OS Windows

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


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">
      <bean class="com.platform.util.spring.SafeClassPathResource">
         <constructor-arg value="META-INF/xsd/service.xsd" />

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 Mon Nov 19 18:03:59 UTC 2018 using JIRA 7.9.2#79002-sha1:3bb15b68ecd99a30eb364c4c1a393359bcad6278.