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

org.springframework.xml.sax.SaxUtils swallows exceptions


    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0.2
    • Fix Version/s: 2.0.4
    • Component/s: Core
    • Labels:
    • Environment:
      Windows/Spring 3.0.6.RELEASE/Websphere Application Server


      While starting a spring-ws application on Websphere, CommonsXsdSchemaCollection makes a call to SaxUtils in order to resolve the location of XSDs defined in the collection. I hit a problem whereby the SaxUtils.getSystemId() swallows an exception (see below) because there is a space in the URL of the XSD. This was a serious pain to track down because the code went on to create a different exception that lead me on a wild goose chase. Would be good if the exception was logged.

      ====================== Note: I've X'd out some of the file names
      [1/18/12 13:47:15:228 CST] 00000017 SystemOut     O 2012-01-18 13:47:15,228 INFO    SaxUtils - resource -class path resource [xsd/XXXXXXXXXXXService_V_1_0.xsd]
      [1/18/12 13:47:15:228 CST] 00000017 SystemOut     O 2012-01-18 13:47:15,228 INFO    SaxUtils - resource URL -wsjar:file:/D:/opt/sw/IBM/SDP/runtimes/base_v7/profiles/was70profile1/installedApps/wn-ila3bga9y136Node01Cell/XXX XXXXXXXX API.ear/xxxx-xx-api-12.1.war/WEB-INF/lib/xxxx-core-api-12.1.jar!/xsd/XXXXXXXXXXXService_V_1_0.xsd
      [1/18/12 13:47:15:228 CST] 00000017 SystemOut     O 2012-01-18 13:47:15,228 INFO    SaxUtils - resource URL external form-wsjar:file:/D:/opt/sw/IBM/SDP/runtimes/base_v7/profiles/was70profile1/installedApps/wn-ila3bga9y136Node01Cell/XXX XXXXXXXX API.ear/xxx-ws-api-12.1.war/WEB-INF/lib/xxxx-core-api-12.1.jar!/xsd/XXXXXXXXXXXService_V_1_0.xsd
      [1/18/12 13:47:15:228 CST] 00000017 SystemOut     O 2012-01-18 13:47:15,228 INFO    SaxUtils - URISyntaxException -
      java.net.URISyntaxException: Illegal character in opaque part at index 113: wsjar:file:/D:/opt/sw/IBM/SDP/runtimes/base_v7/profiles/was70profile1/installedApps/wn-ila3bga9y136Node01Cell/XXX XXXXXXXX API.ear/xxxx-ws-api-12.1.war/WEB-INF/lib/xxxx-core-api-12.1.jar!/xsd/XXXXXXXXXXXService_V_1_0.xsd
      	at java.net.URI$Parser.fail(URI.java:2820)
      	at java.net.URI$Parser.checkChars(URI.java:2993)
      	at java.net.URI$Parser.parse(URI.java:3030)
      	at java.net.URI.<init>(URI.java:589)
      	at org.springframework.xml.sax.SaxUtils.getSystemId(SaxUtils.java:61)

      I modified SaxUtils to produce the logging info above (this is not a suggested solution, just some verbose logging I added to try find out what was happening). Below is the modified code that produced the log output above...

          /** Retrieves the URL from the given resource as System ID. Returns <code>null</code> if it cannot be opened. */
          public static String getSystemId(Resource resource) {
              try {
              	logger.info("resource URL -" + resource.getURL());
              	logger.info("resource URL external form-" + resource.getURL().toExternalForm());
                  return new URI(resource.getURL().toExternalForm()).toString();
              catch (IOException e) {
              	logger.info("IOException -",e);
                  return null;
              catch (URISyntaxException e) {
              	logger.info("URISyntaxException -",e);
                  return null;




            • Assignee:
              arjen.poutsma Arjen Poutsma
              davidnee David Nee
            • Votes:
              0 Vote for this issue
              0 Start watching this issue


              • Created:

                Time Tracking

                Original Estimate - Not Specified
                Not Specified
                Remaining Estimate - Not Specified
                Not Specified
                Time Spent - 0.05h