[jboss-svn-commits] JBL Code SVN: r24239 - in labs/jbossesb/workspace/skeagh/routing/file/src: test/java/org/jboss/esb/file and 1 other directory.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Dec 4 07:57:09 EST 2008
Author: tfennelly
Date: 2008-12-04 07:57:09 -0500 (Thu, 04 Dec 2008)
New Revision: 24239
Modified:
labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/lifecycle/DefaultFileLifecycle.java
labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/FileInboundRouterTest.java
Log:
https://jira.jboss.org/jira/browse/JBESB-2200
Modified: labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/lifecycle/DefaultFileLifecycle.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/lifecycle/DefaultFileLifecycle.java 2008-12-04 12:29:28 UTC (rev 24238)
+++ labs/jbossesb/workspace/skeagh/routing/file/src/main/java/org/jboss/esb/file/lifecycle/DefaultFileLifecycle.java 2008-12-04 12:57:09 UTC (rev 24239)
@@ -19,14 +19,16 @@
*/
package org.jboss.esb.file.lifecycle;
+import org.jboss.esb.util.AssertArgument;
+import org.jboss.esb.util.FileUtil;
+
+import java.io.Closeable;
import java.io.File;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
-import org.jboss.esb.util.AssertArgument;
-import org.jboss.esb.util.FileUtil;
-
/**
* Default file lifecycle.
* <p/>
@@ -230,6 +232,19 @@
final File toFile = new File(toDirectory, evalNameExpression(renameExpression));
checkThatDestinationFileDoesNotExists(toFile);
+ if(payload instanceof Closeable)
+ {
+ try
+ {
+ ((Closeable)payload).close();
+ }
+ catch (IOException e)
+ {
+ // OK... probably already closed by another process. Continue
+ // with the rename...
+ }
+ }
+
final boolean renameResult = getFile().renameTo(toFile);
if (!renameResult)
{
Modified: labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/FileInboundRouterTest.java
===================================================================
--- labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/FileInboundRouterTest.java 2008-12-04 12:29:28 UTC (rev 24238)
+++ labs/jbossesb/workspace/skeagh/routing/file/src/test/java/org/jboss/esb/file/FileInboundRouterTest.java 2008-12-04 12:57:09 UTC (rev 24239)
@@ -20,37 +20,35 @@
*/
package org.jboss.esb.file;
-import static org.jboss.esb.file.FileRoutingConstants.IN_FILE_LASTMOD;
-import static org.jboss.esb.file.FileRoutingConstants.IN_FILE_LENGTH;
-import static org.jboss.esb.file.FileRoutingConstants.IN_FILE_NAME;
-import static org.jboss.esb.file.FileRoutingConstants.IN_FILE_PATH;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.FilenameFilter;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Map;
-
import org.jboss.esb.api.context.InvocationContext;
import org.jboss.esb.api.exception.ConfigurationException;
+import org.jboss.esb.api.exception.DeploymentException;
import org.jboss.esb.api.message.Message;
import org.jboss.esb.api.routing.MessageDispatcher;
-import org.jboss.esb.api.exception.DeploymentException;
import org.jboss.esb.deploy.DeploymentRuntime;
import org.jboss.esb.deploy.DeploymentUtil;
import org.jboss.esb.deploy.config.InboundRouterConfig;
+import static org.jboss.esb.file.FileRoutingConstants.IN_FILE_LASTMOD;
+import static org.jboss.esb.file.FileRoutingConstants.IN_FILE_LENGTH;
+import static org.jboss.esb.file.FileRoutingConstants.IN_FILE_NAME;
+import static org.jboss.esb.file.FileRoutingConstants.IN_FILE_PATH;
import org.jboss.esb.schedule.SchedulingException;
import org.jboss.esb.util.FileUtil;
import org.junit.After;
import org.junit.AfterClass;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
/**
* Unit test for {@link FileInboundRouter}.
More information about the jboss-svn-commits
mailing list