Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EE84D175E7 for ; Wed, 26 Aug 2015 08:17:45 +0000 (UTC) Received: (qmail 67387 invoked by uid 500); 26 Aug 2015 08:17:45 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 67353 invoked by uid 500); 26 Aug 2015 08:17:45 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 67338 invoked by uid 99); 26 Aug 2015 08:17:45 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 26 Aug 2015 08:17:45 +0000 Date: Wed, 26 Aug 2015 08:17:45 +0000 (UTC) From: "Kim (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CXF-6546) Imported XML schemas cannot be read when the file path includes "#" MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CXF-6546?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Kim updated CXF-6546: --------------------- Priority: Minor (was: Major) > Imported XML schemas cannot be read when the file path includes "#" > ------------------------------------------------------------------- > > Key: CXF-6546 > URL: https://issues.apache.org/jira/browse/CXF-6546 > Project: CXF > Issue Type: Bug > Components: Core > Affects Versions: 3.1.2 > Environment: Windows 32 or 64 bit. > Java 1.8. > Tomcat 8.0.24. > Reporter: Kim > Priority: Minor > > I am deploying a webapp on Tomcat (8.0.24) using a multi-level context path (using the # in the name of the war file or the context configuration file). The unpacked files therefore end up in a folder with "#" in the path. > In this case the web application is deployed under the name {{dev#mywebservice.xml}}. > Accessing the generated WSDL works fine, but accessing the imported XML schema using the URL specified in the WSDL's schemaLocation fails. > The WSDL imports a XML schema {{common.xsd}}: > {code:xml} > > {code} > Accessing the XSD using the specified URL fails and gives this stack trace in the log: > {noformat} > java.lang.IllegalArgumentException: The resource path [file:/C:/SOMEFOLDER/apache-tomcat-8.0.24-DEV/webapps/dev%23mywebservice/WEB-INF/classes/wsdl/common.xsd] is not valid > at org.apache.catalina.webresources.StandardRoot.validate(StandardRoot.java:250) > at org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:212) > at org.apache.catalina.webresources.StandardRoot.getResource(StandardRoot.java:206) > at org.apache.catalina.core.ApplicationContext.getResourceAsStream(ApplicationContext.java:579) > at org.apache.catalina.core.ApplicationContextFacade.getResourceAsStream(ApplicationContextFacade.java:210) > at org.apache.cxf.transport.servlet.ServletContextResourceResolver.getAsStream(ServletContextResourceResolver.java:54) > at org.apache.cxf.resource.DefaultResourceManager.findResource(DefaultResourceManager.java:111) > at org.apache.cxf.resource.DefaultResourceManager.getResourceAsStream(DefaultResourceManager.java:67) > at org.apache.cxf.wsdl11.ResourceManagerWSDLLocator.getInputSource(ResourceManagerWSDLLocator.java:54) > at org.apache.cxf.wsdl11.ResourceManagerWSDLLocator.getInputSource(ResourceManagerWSDLLocator.java:48) > at org.apache.cxf.wsdl11.AbstractWrapperWSDLLocator.getBaseInputSource(AbstractWrapperWSDLLocator.java:60) > at org.apache.cxf.frontend.WSDLGetUtils.readXSDDocument(WSDLGetUtils.java:723) > at org.apache.cxf.frontend.WSDLGetUtils.getDocument(WSDLGetUtils.java:151) > {noformat} > > I have done some debugging and found that the problem seems to be in the method > {{org.apache.cxf.resource.URIResolver#tryFileSystem(String baseUriStr, String uriStr)}} > This method is called with parameters > {code} > baseUriStr = null > uriStr = "file:/C:/SOMEFOLDER/apache-tomcat-8.0.24-DEV/webapps/dev%23mywebservice/WEB-INF/classes/wsdl/common.xsd" > {code} > The line {{File f2 = new File(urif);}} throws an {{IllegalArgumentException}} because the "#" (decoded from "%23") has special meaning in URIs. > Some proposed solutions: > * Catch and ignore the {{IllegalArgumentException}} from {{File(URI)}}. > * Construct "f2" using {{File(String)}} instead of {{File(URI)}}. > * Don't URLDecode the content of "orig" before creating "urif" thereby retaining "%23". > An interesting workaround for the problem is including a space in the path: > {code} > uriStr = "file:/C:/SOME%20FOLDER/apache-tomcat-8.0.24-DEV/webapps/dev%23mywebservice/WEB-INF/classes/wsdl/common.xsd" > {code} > This will succeed because the encoded space "%20" is replaced with " " causing a {{URISyntaxException}} to the thrown, caught and ignored. > Using this "workaround" will, however, break other (unrelated) stuff in my application. -- This message was sent by Atlassian JIRA (v6.3.4#6332)