-
Notifications
You must be signed in to change notification settings - Fork 317
Description
David Nee opened SWS-749 and commented
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;
}
}
Affects: 2.0.2
Referenced from: commits 61a1f62