Bug 490992 - don't log error if ~/.ssh/known_hosts doesn't exist
Not having a known_hosts file is not an error.
Change-Id: I75938b6e07b26fc9a6b3bd0b3867a51e63b9fb2d
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
diff --git a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchCorePlugin.java b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchCorePlugin.java
index df14279..1d1c260 100644
--- a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchCorePlugin.java
+++ b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchCorePlugin.java
@@ -11,6 +11,7 @@
*******************************************************************************/
package org.eclipse.jsch.internal.core;
+import java.io.FileNotFoundException;
import java.util.Hashtable;
import java.util.ArrayList;
@@ -196,9 +197,11 @@
getJSch().setKnownHosts(file.getPath());
}
catch(JSchException e){
- JSchCorePlugin.log(IStatus.ERROR, NLS.bind(
- "An error occurred while loading the know hosts file {0}", file //$NON-NLS-1$
- .getAbsolutePath()), e);
+ if (!(e.getCause() instanceof FileNotFoundException)) {
+ JSchCorePlugin.log(IStatus.ERROR, NLS.bind(
+ "An error occurred while loading the know hosts file {0}", file //$NON-NLS-1$
+ .getAbsolutePath()), e);
+ }
}
needToLoadKnownHosts=false;
}