Merge pull request #274 from ghillert/INT-2330

INT-2330 - Upgrade to Apache commons-net 3.0.1

  For reference see: https://jira.springsource.org/browse/INT-2330
This commit is contained in:
Mark Fisher
2011-12-22 12:35:32 -05:00
3 changed files with 15 additions and 6 deletions

View File

@@ -115,7 +115,7 @@ configure(javaprojects) {
aspectjVersion = '1.6.8'
cglibVersion = '2.2'
commonsNetVersion = '2.0'
commonsNetVersion = '3.0.1'
easymockVersion = '2.3'
groovyVersion = '1.8.4'
jacksonVersion = '1.8.3'

View File

@@ -121,7 +121,7 @@
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>2.0</version>
<version>3.0.1</version>
<scope>compile</scope>
</dependency>
<dependency>

View File

@@ -17,13 +17,11 @@
package org.springframework.integration.ftp.session;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import javax.net.ssl.KeyManager;
import javax.net.ssl.TrustManager;
import org.apache.commons.net.ftp.FTPSClient;
import org.springframework.util.StringUtils;
/**
@@ -117,8 +115,19 @@ public class DefaultFtpsSessionFactory extends AbstractFtpSessionFactory<FTPSCli
}
return new FTPSClient(this.implicit);
}
catch (NoSuchAlgorithmException e) {
throw new RuntimeException(e);
catch (Exception e) {
/*
This catch block is technically not necessary but it allows users
to use the older Commons Net 2.0 if necessary, which requires you
to catch a NoSuchAlgorithmException.
*/
if (e instanceof RuntimeException) {
throw (RuntimeException) e;
}
throw new RuntimeException("Failed to create FTPS client.", e);
}
}