[jboss-svn-commits] JBL Code SVN: r19627 - labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Apr 18 11:53:50 EDT 2008
Author: kevin.conner at jboss.com
Date: 2008-04-18 11:53:50 -0400 (Fri, 18 Apr 2008)
New Revision: 19627
Modified:
labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyFTP.java
Log:
Merging CP2_2 changes over to trunk: JBESB-1671
Modified: labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyFTP.java
===================================================================
--- labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyFTP.java 2008-04-18 14:47:33 UTC (rev 19626)
+++ labs/jbossesb/trunk/product/rosetta/src/org/jboss/soa/esb/notification/NotifyFTP.java 2008-04-18 15:53:50 UTC (rev 19627)
@@ -194,10 +194,32 @@
* @see org.jboss.soa.esb.notification.NotificationTarget#sendNotification(org.jboss.soa.esb.message.Message)
*/
public void sendNotification(Message message) throws NotificationException {
+ File fileToSend = null;
+ RemoteFileSystem rfs = null;
+ try {
+ fileToSend = getFileToSend( message );
+ rfs = RemoteFileSystemFactory.getRemoteFileSystem(getFtpEpr(), true);
+ rfs.uploadFile(fileToSend, getFileName(message));
+ } catch (RemoteFileSystemException e) {
+ throw new NotificationException("Could not complete FTP notification", e);
+ } catch (IOException e) {
+ throw new NotificationException("Could not complete FTP notification", e);
+ } finally {
+ if (fileToSend != null) {
+ fileToSend.delete();
+ }
+ if (rfs != null) {
+ rfs.quit();
+ }
+ }
+ }
+
+ protected File getFileToSend( final Message message ) throws IOException
+ {
FileOutputStream stream = null;
File tmpFile = null;
- RemoteFileSystem rfs = null;
- try {
+ try
+ {
tmpFile = File.createTempFile(TEMP_FILE_BASE, null);
stream = new FileOutputStream(tmpFile);
@@ -208,26 +230,17 @@
else
IOUtils.write(payload.toString(), stream);
- stream.close();
- rfs = RemoteFileSystemFactory.getRemoteFileSystem(getFtpEpr(), true);
- rfs.uploadFile(tmpFile, getFileName(message));
- } catch (MessageDeliverException e) {
- log.error( "MessageDeliveryException while calling getPayLoad : " + e );
- } catch (RemoteFileSystemException e) {
- throw new NotificationException("Could not complete FTP notification", e);
- } catch (IOException e) {
- throw new NotificationException("Could not complete FTP notification", e);
- } finally {
- if (stream != null) {
+ stream.close();
+ }
+ catch (MessageDeliverException e)
+ {
+ log.error( "MessageDeliveryException while calling getPayLoad : " + e );
+ }
+ finally
+ {
+ if (stream != null)
IOUtils.closeQuietly(stream);
- }
- if (tmpFile != null) {
- tmpFile.delete();
- }
- if (rfs != null) {
- rfs.quit();
- }
}
+ return tmpFile;
}
-
-}
\ No newline at end of file
+}
More information about the jboss-svn-commits
mailing list