[
https://issues.apache.org/jira/browse/AXIS2-5793?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16141919#comment-16141919
]
Thorsten Schöning edited comment on AXIS2-5793 at 8/25/17 5:22 PM:
-------------------------------------------------------------------
AXIS2-5793: URL.getFile is as bad as File.toURL in case of spaces in paths,
because while toURL doesn't rewrite spaces to %20, getFile on the other hand
doesn't rewrite %20 back into spaces to use in the file system. During running
the tests this lead to modules/webapp creating a wrong directory:
C:\Users\tschoening\Documents\Eclipse\Java\Libs%20Java%203rd\Apache\Axis2\1.7\src\systests\webapp-tests\target\tmp\webapp\WEB-INF\services
vs.
C:\Users\tschoening\Documents\Eclipse\Java\Libs Java
3rd\Apache\Axis2\1.7\src\systests\webapp-tests\target\tmp\webapp\WEB-INF\services
The funny thing is that this path was never used anywhere, it was just created
and even if it couldn't be that wasn't checked as well. I checked that using
deny permissions in the file system, so that the path couldn't be created in
hope I get an exception to find the the place in the code. So I wander if the
code in the CTOR is needed at all? The tests all passed while AdminActions
created the wrong path. :-)
was (Author: tschoening):
AXIS2-5793: URL.getFile is as bad as File.toURL in case of spaces in paths,
because while toURL doesn't rewrite spaces to %20, getFile on the other hand
doesn't rewrite %20 back into spaces to use in the file system. During running
the tests this lead to modules/webapp creating a wrong directory:
C:\Users\tschoening\Documents\Eclipse\Java\Libs%20Java%203rd\Apache\Axis2\1.7\src\systests\webapp-tests\target\tmp\webapp\WEB-INF\services
vs.
C:\Users\tschoening\Documents\Eclipse\Java\Libs Java
3rd\Apache\Axis2\1.7\src\systests\webapp-tests\target\tmp\webapp\WEB-INF\services
> DBCwithReduceWSDLMemoryParmsTests fails if pathes with spaces are used
> ----------------------------------------------------------------------
>
> Key: AXIS2-5793
> URL: https://issues.apache.org/jira/browse/AXIS2-5793
> Project: Axis2
> Issue Type: Bug
> Affects Versions: 1.7.3
> Environment: Windows 8.1 x64 Prof., Tomcat 7.0.68, JDK 1.8.0_92 x64
> Reporter: Thorsten Schöning
> Attachments: AXIS2-5793 AdminActions.patch, AXIS2-5793 all
> others.patch, DescriptionTestUtils2.java.patch,
> DescriptionTestUtils.java.patch,
> TEST-org.apache.axis2.jaxws.description.DBCwithReduceWSDLMemoryParmsTests.xml
>
>
> DBCwithReduceWSDLMemoryParmsTests fails when Axis2 is build using a path with
> spaces:
> {CODE}
> <testcase time="0.017"
> classname="org.apache.axis2.jaxws.description.DBCwithReduceWSDLMemoryParmsTests"
> name="testDBCwithReduceWSDLMemoryParms">
> <failure
> type="junit.framework.AssertionFailedError:">junit.framework.AssertionFailedError:
> null
> at junit.framework.Assert.fail(Assert.java:47)
> at junit.framework.Assert.assertTrue(Assert.java:20)
> at junit.framework.Assert.assertTrue(Assert.java:27)
> at
> org.apache.axis2.jaxws.description.DBCwithReduceWSDLMemoryParmsTests.testDBCwithReduceWSDLMemoryParms(DBCwithReduceWSDLMemoryParmsTests.java:140)
> </failure>
> {CODE}
> After enabling logging using log4j the reason is easier to find:
> {CODE}
> 2016-06-25 11:00:36,857 DEBUG
> org.apache.axis2.jaxws.util.WSDL4JWrapper.<init>: WSDL4JWrapper(Definition,
> boolean) entry
> 2016-06-25 11:00:36,857 DEBUG
> org.apache.axis2.wsdl.util.WSDLDefinitionWrapper.<init>:
> WSDLDefinitionWrapper(Definition,URL,boolean) entry
> 2016-06-25 11:00:36,857 DEBUG
> org.apache.axis2.wsdl.util.WSDLWrapperReloadImpl.isReloadable: Enter
> WSDLWrapperReloadImpl.isReloadable(): null
> 2016-06-25 11:00:36,857 DEBUG
> org.apache.axis2.wsdl.util.WSDLWrapperReloadImpl.getExplicitURI:
> WSDLWrapperReloadImpl.getExplicitURI(file:/C:/Users/tschoening/Documents/Eclipse/Java
> Bug 2187/Libs Java
> 3rd/Apache/Axis2/1.7.3/src/modules/metadata/test-resources/wsdl/BindingNamespaceDefaults.wsdl)
>
> 2016-06-25 11:00:36,857 DEBUG
> org.apache.axis2.wsdl.util.WSDLWrapperReloadImpl.isReloadable:
> WSDLWrapperReloadImpl.isReloaded(): [javax.wsdl.WSDLException] error
> [WSDLException: faultCode=WSDLWrapperReloadImpl : :
> java.net.URISyntaxException: Illegal character in path at index 48:
> file:/C:/Users/tschoening/Documents/Eclipse/Java Bug 2187/Libs Java
> 3rd/Apache/Axis2/1.7.3/src/modules/metadata/test-resources/wsdl/BindingNamespaceDefaults.wsdl]
> javax.wsdl.WSDLException: WSDLException: faultCode=WSDLWrapperReloadImpl : :
> java.net.URISyntaxException: Illegal character in path at index 48:
> file:/C:/Users/tschoening/Documents/Eclipse/Java Bug 2187/Libs Java
> 3rd/Apache/Axis2/1.7.3/src/modules/metadata/test-resources/wsdl/BindingNamespaceDefaults.wsdl
> at
> org.apache.axis2.wsdl.util.WSDLWrapperReloadImpl.getExplicitURI(WSDLWrapperReloadImpl.java:1382)
> {CODE}
> The problem is in DescriptionTestUtils.getWSDLURL:
> {CODE}
> wsdlURL = new File(urlString).getAbsoluteFile().toURL();
> {CODE}
> toURL is kown to fail in situations like these:
> {QUOTE}
> Deprecated. This method does not automatically escape characters that are
> illegal in URLs. It is recommended that new code convert an abstract pathname
> into a URL by first converting it into a URI, via the toURI method, and then
> converting the URI into a URL via the URI.toURL method.
> {QUOTE}
> https://docs.oracle.com/javase/7/docs/api/java/io/File.html#toURL()
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]