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 2016/05/25 08:13:51 UTC

[2/2] camel git commit: CAMEL-8282: Polished. This closes #993.

CAMEL-8282: Polished. This closes #993.


Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/7d2580b5
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/7d2580b5
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/7d2580b5

Branch: refs/heads/master
Commit: 7d2580b571fa8a77e529d8019462717efe3de7ef
Parents: 924d350
Author: Claus Ibsen <da...@apache.org>
Authored: Wed May 25 10:12:15 2016 +0200
Committer: Claus Ibsen <da...@apache.org>
Committed: Wed May 25 10:13:42 2016 +0200

----------------------------------------------------------------------
 .../component/file/remote/SftpConfiguration.java    |  6 ++++--
 .../camel/component/file/remote/SftpOperations.java |  2 +-
 .../file/remote/sftp/SftpServerTestSupport.java     | 16 ++++++++--------
 3 files changed, 13 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/7d2580b5/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java
----------------------------------------------------------------------
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java
index e6f785b..4b5bbd3 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpConfiguration.java
@@ -33,7 +33,7 @@ public class SftpConfiguration extends RemoteFileConfiguration {
 
     @UriParam(label = "security")
     private String knownHostsFile;
-    @UriParam(defaultValue = "true")
+    @UriParam(label = "security", defaultValue = "true")
     private boolean useUserKnownHostsFile = true;
     @UriParam(label = "security")
     private String knownHostsUri;
@@ -102,11 +102,13 @@ public class SftpConfiguration extends RemoteFileConfiguration {
         return useUserKnownHostsFile;
     }
 
+    /**
+     * If knownHostFile has not been explicit configured then use the host file from System.getProperty(user.home)/.ssh/known_hosts
+     */
     public void setUseUserKnownHostsFile(boolean useUserKnownHostsFile) {
         this.useUserKnownHostsFile = useUserKnownHostsFile;
     }
 
-
     /**
      * Sets the known_hosts file (loaded from classpath by default), so that the SFTP endpoint can do host key verification.
      */

http://git-wip-us.apache.org/repos/asf/camel/blob/7d2580b5/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
----------------------------------------------------------------------
diff --git a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
index 0673f2c..4247997 100644
--- a/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
+++ b/components/camel-ftp/src/main/java/org/apache/camel/component/file/remote/SftpOperations.java
@@ -279,7 +279,7 @@ public class SftpOperations implements RemoteFileOperations<ChannelSftp.LsEntry>
         String knownHostsFile = sftpConfig.getKnownHostsFile();
         if (knownHostsFile == null && sftpConfig.isUseUserKnownHostsFile()) {
             knownHostsFile = System.getProperty("user.home") + "/.ssh/known_hosts";
-            LOG.info("Known host file not configured, using user known host file: " + knownHostsFile);
+            LOG.info("Known host file not configured, using user known host file: {}", knownHostsFile);
         }
         jsch.setKnownHosts(ObjectHelper.isEmpty(knownHostsFile) ? null : knownHostsFile);
 

http://git-wip-us.apache.org/repos/asf/camel/blob/7d2580b5/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpServerTestSupport.java
----------------------------------------------------------------------
diff --git a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpServerTestSupport.java b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpServerTestSupport.java
index b6c5973..1e323ac 100644
--- a/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpServerTestSupport.java
+++ b/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/sftp/SftpServerTestSupport.java
@@ -51,17 +51,17 @@ public class SftpServerTestSupport extends BaseServerTestSupport {
         deleteDirectory(FTP_ROOT_DIR);
 
         oldUserHome = System.getProperty("user.home");
-        
+
         System.setProperty("user.home", "target/user-home");
-        
+
         String simulatedUserHome = "target/user-home";
-        String simulatedUserSsh  = "target/user-home/.ssh";
+        String simulatedUserSsh = "target/user-home/.ssh";
         deleteDirectory(simulatedUserHome);
-		createDirectory(simulatedUserHome);
-		createDirectory(simulatedUserSsh);
-		
-		FileUtils.copyInputStreamToFile(getClass().getClassLoader().getResourceAsStream("known_hosts"), new File(simulatedUserSsh+"/known_hosts"));
-        
+        createDirectory(simulatedUserHome);
+        createDirectory(simulatedUserSsh);
+
+        FileUtils.copyInputStreamToFile(getClass().getClassLoader().getResourceAsStream("known_hosts"), new File(simulatedUserSsh + "/known_hosts"));
+
         super.setUp();
 
         setUpServer();