@@ -73,7 +73,6 @@ private void configureClient(final FileSystemOptions fileSystemOptions, final C
7373 final String key = builder .getEntryParser (fileSystemOptions );
7474 if (key != null ) {
7575 final FTPClientConfig config = new FTPClientConfig (key );
76-
7776 final String serverLanguageCode = builder .getServerLanguageCode (fileSystemOptions );
7877 if (serverLanguageCode != null ) {
7978 config .setServerLanguageCode (serverLanguageCode );
@@ -101,7 +100,6 @@ private void configureClient(final FileSystemOptions fileSystemOptions, final C
101100 }
102101 config .setShortMonthNames (shortMonthNamesStr .toString ());
103102 }
104-
105103 client .configure (config );
106104 }
107105 }
@@ -133,14 +131,11 @@ public C createConnection(final String hostname, final int port, char[] username
133131 if (username == null ) {
134132 username = ANON_CHAR_ARRAY ;
135133 }
136-
137134 if (password == null ) {
138135 password = ANON_CHAR_ARRAY ;
139136 }
140-
141137 try {
142138 final C client = createClient (fileSystemOptions );
143-
144139 if (log .isDebugEnabled ()) {
145140 final Writer writer = new StringWriter (1024 ) {
146141 @ Override
@@ -157,54 +152,41 @@ public void flush() {
157152 };
158153 client .addProtocolCommandListener (new PrintCommandListener (new PrintWriter (writer )));
159154 }
160-
161155 configureClient (fileSystemOptions , client );
162-
163156 final FTPFileEntryParserFactory myFactory = builder .getEntryParserFactory (fileSystemOptions );
164157 if (myFactory != null ) {
165158 client .setParserFactory (myFactory );
166159 }
167-
168160 final Boolean remoteVerification = builder .getRemoteVerification (fileSystemOptions );
169161 if (remoteVerification != null ) {
170162 client .setRemoteVerificationEnabled (remoteVerification .booleanValue ());
171163 }
172-
173164 try {
174165 final Duration connectTimeout = builder .getConnectTimeoutDuration (fileSystemOptions );
175166 if (connectTimeout != null ) {
176167 client .setDefaultTimeout (DurationUtils .toMillisInt (connectTimeout ));
177168 }
178-
179169 final String controlEncoding = builder .getControlEncoding (fileSystemOptions );
180170 if (controlEncoding != null ) {
181171 client .setControlEncoding (controlEncoding );
182172 }
183-
184173 final Boolean autodetectUTF8 = builder .getAutodetectUtf8 (fileSystemOptions );
185174 if (autodetectUTF8 != null ) {
186175 client .setAutodetectUTF8 (autodetectUTF8 );
187176 }
188-
189177 final Proxy proxy = builder .getProxy (fileSystemOptions );
190178 if (proxy != null ) {
191179 client .setProxy (proxy );
192180 }
193-
194181 client .connect (hostname , port );
195-
196182 final int reply = client .getReplyCode ();
197183 if (!FTPReply .isPositiveCompletion (reply )) {
198184 throw new FileSystemException ("vfs.provider.ftp/connect-rejected.error" , hostname );
199185 }
200-
201186 // Login
202- if (!client .login (UserAuthenticatorUtils .toString (username ),
203- UserAuthenticatorUtils .toString (password ))) {
204- throw new FileSystemException ("vfs.provider.ftp/login.error" , hostname ,
205- UserAuthenticatorUtils .toString (username ));
187+ if (!client .login (UserAuthenticatorUtils .toString (username ), UserAuthenticatorUtils .toString (password ))) {
188+ throw new FileSystemException ("vfs.provider.ftp/login.error" , hostname , UserAuthenticatorUtils .toString (username ));
206189 }
207-
208190 FtpFileType fileType = builder .getFileType (fileSystemOptions );
209191 if (fileType == null ) {
210192 fileType = FtpFileType .BINARY ;
@@ -213,53 +195,43 @@ public void flush() {
213195 if (!client .setFileType (fileType .getValue ())) {
214196 throw new FileSystemException ("vfs.provider.ftp/set-file-type.error" , fileType );
215197 }
216-
217198 // Set dataTimeout value
218199 final Duration dataTimeout = builder .getDataTimeoutDuration (fileSystemOptions );
219200 if (dataTimeout != null ) {
220201 client .setDataTimeout (dataTimeout );
221202 }
222-
223203 final Duration socketTimeout = builder .getSoTimeoutDuration (fileSystemOptions );
224204 if (socketTimeout != null ) {
225205 client .setSoTimeout (DurationUtils .toMillisInt (socketTimeout ));
226206 }
227-
228207 final Duration controlKeepAliveTimeout = builder .getControlKeepAliveTimeout (fileSystemOptions );
229208 if (controlKeepAliveTimeout != null ) {
230209 client .setControlKeepAliveTimeout (controlKeepAliveTimeout );
231210 }
232-
233- final Duration controlKeepAliveReplyTimeout = builder
234- .getControlKeepAliveReplyTimeout (fileSystemOptions );
211+ final Duration controlKeepAliveReplyTimeout = builder .getControlKeepAliveReplyTimeout (fileSystemOptions );
235212 if (controlKeepAliveReplyTimeout != null ) {
236213 client .setControlKeepAliveReplyTimeout (controlKeepAliveReplyTimeout );
237214 }
238-
239215 final Boolean userDirIsRoot = builder .getUserDirIsRoot (fileSystemOptions );
240216 if (workingDirectory != null && (userDirIsRoot == null || !userDirIsRoot .booleanValue ())
241- && !client .changeWorkingDirectory (workingDirectory )) {
217+ && !client .changeWorkingDirectory (workingDirectory )) {
242218 throw new FileSystemException ("vfs.provider.ftp/change-work-directory.error" , workingDirectory );
243219 }
244-
245220 final Boolean passiveMode = builder .getPassiveMode (fileSystemOptions );
246221 if (passiveMode != null && passiveMode .booleanValue ()) {
247222 client .enterLocalPassiveMode ();
248223 }
249-
250224 final Range <Integer > activePortRange = builder .getActivePortRange (fileSystemOptions );
251225 if (activePortRange != null ) {
252226 client .setActivePortRange (activePortRange .getMinimum (), activePortRange .getMaximum ());
253227 }
254-
255228 setupOpenConnection (client , fileSystemOptions );
256229 } catch (final IOException e ) {
257230 if (client .isConnected ()) {
258231 client .disconnect ();
259232 }
260233 throw e ;
261234 }
262-
263235 return client ;
264236 } catch (final Exception exc ) {
265237 throw new FileSystemException ("vfs.provider.ftp/connect.error" , exc , hostname );
0 commit comments