You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2014/02/25 19:08:44 UTC
git commit: We don't allow for file appending when using either
tempPrefix ord tempFileName
Repository: camel
Updated Branches:
refs/heads/master 77bbb6e27 -> 92200b5f8
We don't allow for file appending when using either tempPrefix ord tempFileName
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/92200b5f
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/92200b5f
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/92200b5f
Branch: refs/heads/master
Commit: 92200b5f8c9c312b7b0797db308a9ed6318cb0fa
Parents: 77bbb6e
Author: Jonathan Anstey <ja...@gmail.com>
Authored: Tue Feb 25 14:38:30 2014 -0330
Committer: Jonathan Anstey <ja...@gmail.com>
Committed: Tue Feb 25 14:38:30 2014 -0330
----------------------------------------------------------------------
.../java/org/apache/camel/component/file/FileEndpoint.java | 6 +++---
.../component/file/FileProducerTempFileExistsIssueTest.java | 9 ++++++++-
2 files changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/92200b5f/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java b/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java
index a3d1256..21f7fdb 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/FileEndpoint.java
@@ -101,9 +101,9 @@ public class FileEndpoint extends GenericFileEndpoint<File> {
public GenericFileProducer<File> createProducer() throws Exception {
ObjectHelper.notNull(operations, "operations");
- // you cannot use temp prefix and file exists append
- if (getFileExist() == GenericFileExist.Append && getTempPrefix() != null) {
- throw new IllegalArgumentException("You cannot set both fileExist=Append and tempPrefix options");
+ // you cannot use temp file and file exists append
+ if (getFileExist() == GenericFileExist.Append && ((getTempPrefix() != null) || (getTempFileName() != null))) {
+ throw new IllegalArgumentException("You cannot set both fileExist=Append and tempPrefix/tempFileName options");
}
// ensure fileExist and moveExisting is configured correctly if in use
http://git-wip-us.apache.org/repos/asf/camel/blob/92200b5f/camel-core/src/test/java/org/apache/camel/component/file/FileProducerTempFileExistsIssueTest.java
----------------------------------------------------------------------
diff --git a/camel-core/src/test/java/org/apache/camel/component/file/FileProducerTempFileExistsIssueTest.java b/camel-core/src/test/java/org/apache/camel/component/file/FileProducerTempFileExistsIssueTest.java
index 972583c..fe1ebd5 100644
--- a/camel-core/src/test/java/org/apache/camel/component/file/FileProducerTempFileExistsIssueTest.java
+++ b/camel-core/src/test/java/org/apache/camel/component/file/FileProducerTempFileExistsIssueTest.java
@@ -43,7 +43,14 @@ public class FileProducerTempFileExistsIssueTest extends ContextTestSupport {
context.getEndpoint("file://target/tempprefix?fileExist=Append&tempPrefix=foo").createProducer();
fail("Should have thrown exception");
} catch (IllegalArgumentException e) {
- assertEquals("You cannot set both fileExist=Append and tempPrefix options", e.getMessage());
+ assertEquals("You cannot set both fileExist=Append and tempPrefix/tempFileName options", e.getMessage());
+ }
+
+ try {
+ context.getEndpoint("file://target/tempprefix?fileExist=Append&tempFileName=foo").createProducer();
+ fail("Should have thrown exception");
+ } catch (IllegalArgumentException e) {
+ assertEquals("You cannot set both fileExist=Append and tempPrefix/tempFileName options", e.getMessage());
}
}