From 5a757523d1309100fdd11389b4bfe0b091ad91f8 Mon Sep 17 00:00:00 2001 From: Oleg Zhurakousky Date: Sun, 21 Nov 2010 12:04:16 -0500 Subject: [PATCH] INT-1638 removed unused dependencies form manifests, made minor refactoring to sftp and ftp modules to removed dependencies on commons-io and commons-lang --- .../ftp/outbound/FtpSendingMessageHandler.java | 5 ++--- spring-integration-ftp/template.mf | 1 - .../sftp/inbound/SftpInboundFileSynchronizer.java | 9 ++++----- .../sftp/outbound/SftpSendingMessageHandler.java | 8 +++----- spring-integration-sftp/template.mf | 2 -- spring-integration-twitter/template.mf | 2 -- spring-integration-xmpp/template.mf | 1 - 7 files changed, 9 insertions(+), 19 deletions(-) diff --git a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/outbound/FtpSendingMessageHandler.java b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/outbound/FtpSendingMessageHandler.java index f8163e7f8b..4312e868b0 100644 --- a/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/outbound/FtpSendingMessageHandler.java +++ b/spring-integration-ftp/src/main/java/org/springframework/integration/ftp/outbound/FtpSendingMessageHandler.java @@ -24,8 +24,6 @@ import java.io.IOException; import java.io.OutputStreamWriter; import java.nio.charset.Charset; -import org.apache.commons.lang.SystemUtils; - import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.Resource; import org.springframework.expression.Expression; @@ -62,7 +60,8 @@ public class FtpSendingMessageHandler extends AbstractMessageHandler { private volatile File temporaryBufferFolderFile; - private volatile Resource temporaryBufferFolder = new FileSystemResource(SystemUtils.getJavaIoTmpDir()); + private volatile Resource temporaryBufferFolder = + new FileSystemResource(System.getProperty("java.io.tmpdir")); private volatile String charset = Charset.defaultCharset().name(); diff --git a/spring-integration-ftp/template.mf b/spring-integration-ftp/template.mf index 7bbc715529..ceb9a22375 100644 --- a/spring-integration-ftp/template.mf +++ b/spring-integration-ftp/template.mf @@ -5,7 +5,6 @@ Bundle-Version: ${version} Bundle-ManifestVersion: 2 Import-Template: org.apache.commons.logging;version="[1.1.1, 2.0.0)", - org.apache.commons.lang.*;version="[2.5.0, 3.0.0)", org.apache.commons.net.*;version="[2.0.0, 3.0.0)", org.springframework.integration.*;version="[2.0.0, 2.0.1)", org.springframework.beans.*;version="[3.0.5, 4.0.0)", diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/inbound/SftpInboundFileSynchronizer.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/inbound/SftpInboundFileSynchronizer.java index cdc94406aa..11c6be963e 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/inbound/SftpInboundFileSynchronizer.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/inbound/SftpInboundFileSynchronizer.java @@ -21,14 +21,13 @@ import java.io.FileOutputStream; import java.io.InputStream; import java.util.Collection; -import org.apache.commons.io.IOUtils; - import org.springframework.integration.MessagingException; import org.springframework.integration.file.remote.session.Session; import org.springframework.integration.file.remote.session.SessionFactory; import org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizer; import org.springframework.integration.file.remote.synchronizer.AbstractInboundFileSynchronizingMessageSource; import org.springframework.util.Assert; +import org.springframework.util.FileCopyUtils; import com.jcraft.jsch.ChannelSftp; @@ -116,11 +115,11 @@ public class SftpInboundFileSynchronizer extends AbstractInboundFileSynchronizer String remoteFqPath = this.remotePath + "/" + entry.getFilename(); in = session.get(remoteFqPath); try { - IOUtils.copy(in, fileOutputStream); + FileCopyUtils.copy(in, fileOutputStream); } finally { - IOUtils.closeQuietly(in); - IOUtils.closeQuietly(fileOutputStream); + in.close(); + fileOutputStream.close(); } if (tmpLocalTarget.renameTo(localFile)) { this.acknowledge(session, entry); diff --git a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/outbound/SftpSendingMessageHandler.java b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/outbound/SftpSendingMessageHandler.java index bb786900e2..48b6e10007 100644 --- a/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/outbound/SftpSendingMessageHandler.java +++ b/spring-integration-sftp/src/main/java/org/springframework/integration/sftp/outbound/SftpSendingMessageHandler.java @@ -24,9 +24,6 @@ import java.io.InputStream; import java.io.OutputStreamWriter; import java.nio.charset.Charset; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang.SystemUtils; - import org.springframework.core.io.FileSystemResource; import org.springframework.core.io.Resource; import org.springframework.expression.Expression; @@ -65,7 +62,8 @@ public class SftpSendingMessageHandler extends AbstractMessageHandler { private volatile File temporaryBufferFolderFile; - private volatile Resource temporaryBufferFolder = new FileSystemResource(SystemUtils.getJavaIoTmpDir()); + private volatile Resource temporaryBufferFolder = + new FileSystemResource(System.getProperty("java.io.tmpdir")); private volatile String charset = Charset.defaultCharset().name(); @@ -184,7 +182,7 @@ public class SftpSendingMessageHandler extends AbstractMessageHandler { return true; } finally { - IOUtils.closeQuietly(fileInputStream); + fileInputStream.close(); session.close(); } } diff --git a/spring-integration-sftp/template.mf b/spring-integration-sftp/template.mf index dbcfa9d003..5e4c175d7f 100644 --- a/spring-integration-sftp/template.mf +++ b/spring-integration-sftp/template.mf @@ -5,8 +5,6 @@ Bundle-Version: ${version} Bundle-ManifestVersion: 2 Import-Template: org.apache.commons.logging;version="[1.1.1, 2.0.0)", - org.apache.commons.lang.*;version="[2.5.0, 3.0.0)", - org.apache.commons.io.*;version="[1.4.0, 2.0.0)", org.springframework.integration.*;version="[2.0.0, 2.0.1)", org.springframework.beans.*;version="[3.0.5, 4.0.0)", org.springframework.context;version="[3.0.5, 4.0.0)", diff --git a/spring-integration-twitter/template.mf b/spring-integration-twitter/template.mf index 8882160e3a..e35359e1e5 100644 --- a/spring-integration-twitter/template.mf +++ b/spring-integration-twitter/template.mf @@ -6,7 +6,6 @@ Bundle-ManifestVersion: 2 Import-Template: org.aopalliance.*;version="[1.0.0, 2.0.0)", org.apache.commons.logging;version="[1.1.1, 2.0.0)", - org.apache.commons.lang.*;version="[2.5.0, 3.0.0)", org.springframework.integration.*;version="[2.0.0, 2.0.1)", org.springframework.scheduling.*;version="[3.0.5, 4.0.0)", org.springframework.aop.*;version="[3.0.5, 4.0.0)", @@ -16,7 +15,6 @@ Import-Template: org.springframework.scheduling.*;version="[3.0.5, 4.0.0)", org.springframework.util;version="[3.0.5, 4.0.0)", org.jivesoftware.*;version="[3.1.0, 4.0.0)", - org.apache.commons.io.*;version="[1.4, 3.0)", twitter4j.*;version="[2.1.0, 2.3.0)", javax.*;version="0", org.w3c.dom.*;version="0" diff --git a/spring-integration-xmpp/template.mf b/spring-integration-xmpp/template.mf index 2811950673..1c0572e46c 100644 --- a/spring-integration-xmpp/template.mf +++ b/spring-integration-xmpp/template.mf @@ -5,7 +5,6 @@ Bundle-Version: ${version} Bundle-ManifestVersion: 2 Import-Template: org.apache.commons.logging;version="[1.1.1, 2.0.0)", - org.apache.commons.lang.*;version="[2.5.0, 3.0.0)", org.springframework.integration.*;version="[2.0.0, 2.0.1)", org.springframework.beans.*;version="[3.0.5, 4.0.0)", org.springframework.context;version="[3.0.5, 4.0.0)",