You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2009/03/09 13:14:15 UTC
svn commit: r751658 - in /camel/trunk:
camel-core/src/main/java/org/apache/camel/component/file/
components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/
Author: davsclaus
Date: Mon Mar 9 12:14:15 2009
New Revision: 751658
URL: http://svn.apache.org/viewvc?rev=751658&view=rev
Log:
CAMEL-1428: SFTP problems with XP. Fixed a bug with CamelFilePath and added DEBUG logging when changing name.
Modified:
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFile.java
camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileExchange.java
camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/PaddyRouteTest.java
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFile.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFile.java?rev=751658&r1=751657&r2=751658&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFile.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFile.java Mon Mar 9 12:14:15 2009
@@ -21,6 +21,8 @@
import org.apache.camel.util.FileUtil;
import org.apache.camel.util.ObjectHelper;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
/**
* Generic File. Specific implementations of a file based endpoint need to
@@ -28,6 +30,8 @@
*/
public class GenericFile<T> implements Serializable {
+ private static final Log LOG = LogFactory.getLog(GenericFile.class);
+
private String endpointPath;
private String fileName;
private String fileNameOnly;
@@ -83,12 +87,15 @@
* @param newName the new name
*/
public void changeFileName(String newName) {
- newName = FileUtil.normalizePath(newName);
+ // TODO: Should be TRACE
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Changing name to: " + newName);
+ }
// use java.io.File to help us with computing name changes
File file = new File(newName);
- boolean absolute = file.isAbsolute();
boolean nameChangeOnly = newName.indexOf(getFileSeparator()) == -1;
+ boolean absolute = file.isAbsolute();
// store the file name only
setFileNameOnly(file.getName());
@@ -115,6 +122,11 @@
// construct a pseudo absolute filename that the file operations uses
setAbsoluteFilePath(endpointPath + getFileSeparator() + getRelativeFilePath());
}
+
+ // TODO: Should be TRACE
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Name changed: " + this);
+ }
}
private String changeNameOnly(String path, String name) {
Modified: camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileExchange.java
URL: http://svn.apache.org/viewvc/camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileExchange.java?rev=751658&r1=751657&r2=751658&view=diff
==============================================================================
--- camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileExchange.java (original)
+++ camel/trunk/camel-core/src/main/java/org/apache/camel/component/file/GenericFileExchange.java Mon Mar 9 12:14:15 2009
@@ -69,7 +69,9 @@
if (file.isAbsolute()) {
getIn().setHeader("CamelFilePath", file.getAbsoluteFilePath());
} else {
- getIn().setHeader("CamelFilePath", file.getEndpointPath() + File.separator + file.getRelativeFilePath());
+ // we must normal path according to protocol if we build our own paths
+ String path = file.normalizePathToProtocol(file.getEndpointPath() + File.separator + file.getRelativeFilePath());
+ getIn().setHeader("CamelFilePath", path);
}
getIn().setHeader("CamelFileRelativePath", file.getRelativeFilePath());
Modified: camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/PaddyRouteTest.java
URL: http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/PaddyRouteTest.java?rev=751658&r1=751657&r2=751658&view=diff
==============================================================================
--- camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/PaddyRouteTest.java (original)
+++ camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/PaddyRouteTest.java Mon Mar 9 12:14:15 2009
@@ -18,6 +18,7 @@
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
+import org.apache.camel.processor.interceptor.Tracer;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.component.mock.MockEndpoint;
@@ -44,6 +45,8 @@
return new RouteBuilder() {
@Override
public void configure() throws Exception {
+ getContext().addInterceptStrategy(new Tracer());
+
from(getFtpUrl()).process(new Processor() {
public void process(Exchange exchange) throws Exception {
assertNotNull(exchange.getIn().getHeader(Exchange.FILE_NAME));