Description
In what version(s) of Spring Integration are you seeing this issue?
6.4.1
Describe the bug
With the introduction of the fix of GH-9711 that uses the new rawUrl
method (thanks for the solution there by the way), I noticed that some existing connections suddenly were unauthorized. On investigation, it appeared that the common denominator is that in the cases of the connection breaking, the password contained an @
character. With the way the underlying JCIFS library calls the URL constructor, it will trigger the java.net.Url
code to look for indexOf('@')
. When the URL resulting from the rawUrl
method would be smb://sambaguest:samb@guest@127.0.0.1:445/smb share
, java.net.URL
will interpret the host part as empty string (see screencap below). This (obviously) subsequently yields a UnknownHostException
.
To Reproduce
Add the following lines to the existing SmbMessageHistoryTests#testMessageHistory
method, it will fail on the assertion:
CIFSContext context = new BaseContext(new PropertyConfiguration(new Properties()));
URL rawUrl = new URL(null, smbSessionFactory.rawUrl(true), context.getUrlHandler());
assertThat(rawUrl.getHost()).isEqualTo("localhost");
Expected behavior
The @
character can be used in the domain, username or password as it could before the fix.