-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Description
Affects: 5.2.3-RELEASE
I am running on windows, trying to load properties from a shared network folder like \\remotehost\sharedfolder\common.properties, with ignoreResourceNotFound
is set to true
. If the property file is there, everything works, but in case the file is missing, loading fails with this somehow misleading exception:
java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method) ~[na:1.8.0_151]
at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) ~[na:1.8.0_151]
at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[na:1.8.0_151]
at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[na:1.8.0_151]
at java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[na:1.8.0_151]
at java.net.PlainSocketImpl.connect(Unknown Source) ~[na:1.8.0_151]
at java.net.Socket.connect(Unknown Source) ~[na:1.8.0_151]
at sun.net.ftp.impl.FtpClient.doConnect(Unknown Source) ~[na:1.8.0_151]
at sun.net.ftp.impl.FtpClient.tryConnect(Unknown Source) ~[na:1.8.0_151]
at sun.net.ftp.impl.FtpClient.connect(Unknown Source) ~[na:1.8.0_151]
at sun.net.ftp.impl.FtpClient.connect(Unknown Source) ~[na:1.8.0_151]
at sun.net.www.protocol.ftp.FtpURLConnection.connect(Unknown Source) ~[na:1.8.0_151]
at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(Unknown Source) ~[na:1.8.0_151]
at org.springframework.core.io.UrlResource.getInputStream(UrlResource.java:173) ~[spring-core-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.core.io.support.EncodedResource.getInputStream(EncodedResource.java:159) ~[spring-core-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.core.io.support.PropertiesLoaderUtils.fillProperties(PropertiesLoaderUtils.java:99) ~[spring-core-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.core.io.support.PropertiesLoaderSupport.loadProperties(PropertiesLoaderSupport.java:181) ~[spring-core-5.2.3.RELEASE.jar:5.2.3.RELEASE]
This error is very similar for example to this one in bitbucket issue. My simplistic view is, that ConnectException
could be ignored, but I am not sure, what this change could break.
If adding ConnectException
to the ignore list is not possible, PropertiesLoaderSupport
could be made more flexible so we could override its behaviour. Now, all the important fields like locations
are not accessible to an ancestor class as well as PropertiesLoaderUtils.fillProperties()
is not visible. If the loader would like to be super user friendly, it would also allow somehow to set timeout on URLConnection
through UrlResource.getInputStream()
.