diff options
Diffstat (limited to 'bundles/org.eclipse.jsch.core/src/org')
8 files changed, 47 insertions, 71 deletions
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 cecf38532..fcc4a0bd0 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2014 IBM Corporation and others. + * Copyright (c) 2000, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -240,6 +240,7 @@ public class JSchCorePlugin extends Plugin{ return (IProxyService)tracker.getService(); } + @Override public void start(BundleContext context) throws Exception{ super.start(context); tracker=new ServiceTracker<Object, Object>(getBundle().getBundleContext(), @@ -250,6 +251,7 @@ public class JSchCorePlugin extends Plugin{ new Hashtable<String, Object>()); } + @Override public void stop(BundleContext context) throws Exception{ super.stop(context); tracker.close(); diff --git a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchLocation.java b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchLocation.java index 6417cffb0..0ef56f5fb 100644 --- a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchLocation.java +++ b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchLocation.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 JCraft,Inc. and others. + * Copyright (c) 2007, 2019 JCraft,Inc. and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -48,82 +48,60 @@ public class JSchLocation extends PlatformObject implements IJSchLocation{ this(user, host, DEFAULT_PORT); } - /** - * @see IJSchLocation#getHost() - */ + @Override public String getHost(){ return host; } - /** - * @see IJSchLocation#getPort() - */ + @Override public int getPort(){ return port; } - /* - * @see IJSchLocation#setUsername(String) - */ + @Override public void setUsername(String user){ if(userFixed) throw new UnsupportedOperationException(); this.user=user; } - /** - * @see IJSchLocation#getUsername() - */ + @Override public String getUsername(){ return user==null ? "" : user; //$NON-NLS-1$ } - /** - * @see IJSchLocation#setPassword(String) - */ + @Override public void setPassword(String password){ if(password!=null) this.password=password; } - /** - * @see IJSchLocation#getPassword() - */ + @Override public String getPassword(){ return password; } - /** - * @see IJSchLocation#setComment(String comment) - */ + @Override public void setComment(String comment){ this.comment=comment; } - /** - * @see IJSchLocation#getComment() - */ + @Override public String getComment(){ return comment; } - /** - * @see IJSchLocation#setPasswordStore(IPasswordStore store) - */ + @Override public void setPasswordStore(IPasswordStore store){ this.passwordStore=store; } - /** - * @see IJSchLocation#getPasswordStore() - */ + @Override public IPasswordStore getPasswordStore(){ return passwordStore; } - /** - * Implementation of inherited toString() - */ + @Override public String toString(){ return user +"@"+host+((port==DEFAULT_PORT) ? "" : ":"+(Integer.valueOf(port).toString())); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ diff --git a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchProvider.java b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchProvider.java index bff9274d8..7680bb71f 100644 --- a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchProvider.java +++ b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/JSchProvider.java @@ -35,9 +35,7 @@ class JSchProvider implements IJSchService { private static JSchProvider instance; - /* (non-Javadoc) - * @see org.eclipse.jsch.core.IJSchService#createSession(java.lang.String, int, java.lang.String) - */ + @Override public Session createSession(String host, int port, String username) throws JSchException { if(JSchCorePlugin.getPlugin().isNeedToLoadKnownHosts()){ @@ -51,9 +49,7 @@ class JSchProvider implements IJSchService { return Utils.createSession(JSchCorePlugin.getPlugin().getJSch(), username, host, port); } - /* (non-Javadoc) - * @see org.eclipse.jsch.core.IJSchService#createSession(IJSchLocation location, UserInfo uinfo) - */ + @Override public Session createSession(IJSchLocation location, UserInfo uinfo) throws JSchException { Session session=createSession(location.getHost(), location.getPort(), location.getUsername()); @@ -74,9 +70,7 @@ class JSchProvider implements IJSchService { return createSession(location, null); } - /** - * @see org.eclipse.jsch.core.IJSchService#connect(com.jcraft.jsch.Session, int, org.eclipse.core.runtime.IProgressMonitor) - */ + @Override public void connect(Session session, int timeout, IProgressMonitor monitor) throws JSchException{ session.setSocketFactory(new ResponsiveSocketFactory(monitor, timeout)); @@ -122,9 +116,7 @@ class JSchProvider implements IJSchService { ((UserInfoImpl)ui).connectionMade(); } - /** - * @see org.eclipse.jsch.core.IJSchService#getProxyForHost(java.lang.String, java.lang.String) - */ + @Override public Proxy getProxyForHost(String host, String proxyType) { return Utils.getProxyForHost(host, proxyType); } @@ -135,9 +127,7 @@ class JSchProvider implements IJSchService { return instance; } - /* (non-Javadoc) - * @see org.eclipse.jsch.core.IJSchService#connect(com.jcraft.jsch.Proxy, java.lang.String, int, int, org.eclipse.core.runtime.IProgressMonitor) - */ + @Override public void connect(Proxy proxy, String host, int port, int timeout, IProgressMonitor monitor) throws JSchException { try{ @@ -187,6 +177,7 @@ class JSchProvider implements IJSchService { } } + @Override public JSch getJSch(){ return JSchCorePlugin.getPlugin().getJSch(); } @@ -201,9 +192,7 @@ class JSchProvider implements IJSchService { return ((UserInfoImpl)session.getUserInfo()).hasPromptExceededTimeout(); } - /** - * @see org.eclipse.jsch.core.IJSchService#getLocation(String user, String host, int port) - */ + @Override public IJSchLocation getLocation(String user, String host, int port){ IJSchLocation location=null; location=new JSchLocation(user, host, port); diff --git a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/NullUserAuthenticator.java b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/NullUserAuthenticator.java index cc7f97b06..30965a992 100644 --- a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/NullUserAuthenticator.java +++ b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/NullUserAuthenticator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 JCraft,Inc. and others. + * Copyright (c) 2007, 2019 JCraft,Inc. and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -22,34 +22,25 @@ import org.eclipse.jsch.core.IJSchLocation; */ class NullUserAuthenticator implements IUserAuthenticator{ - /** - * @see IUserAuthenticator#prompt(IJSchLocation location, int promptType, String title, - String message, int[] promptResponses, int defaultResponseIndex) - */ + @Override public int prompt(IJSchLocation location, int promptType, String title, String message, int[] promptResponses, int defaultResponseIndex){ return IUserAuthenticator.CANCEL_ID; } - /** - * @see IUserAuthenticator#promptForHostKeyChange(IJSchLocation location) - */ + @Override public boolean promptForHostKeyChange(IJSchLocation location){ return false; } - /** - * @see IUserAuthenticator#promptForKeyboradInteractive(IJSchLocation location, String destination, String name, String instruction, String[] prompt, boolean[] echo) - */ + @Override public String[] promptForKeyboradInteractive(IJSchLocation location, String destination, String name, String instruction, String[] prompt, boolean[] echo){ return null; } - /** - * @see IUserAuthenticator#promptForUserInfo(IJSchLocation, IUserInfo, String) - */ + @Override public void promptForUserInfo(IJSchLocation location, IUserInfo userInfo, String message){ // no operation diff --git a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/PreferenceInitializer.java b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/PreferenceInitializer.java index fb2730665..86505f0bc 100644 --- a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/PreferenceInitializer.java +++ b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/PreferenceInitializer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -41,6 +41,7 @@ public class PreferenceInitializer extends AbstractPreferenceInitializer{ } } + @Override public void initializeDefaultPreferences(){ IEclipsePreferences defaultNode=DefaultScope.INSTANCE .getNode(JSchCorePlugin.ID); diff --git a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/PreferenceModifyListener.java b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/PreferenceModifyListener.java index 5baebca1e..4e3337fd6 100644 --- a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/PreferenceModifyListener.java +++ b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/PreferenceModifyListener.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2013 IBM Corporation and others. + * Copyright (c) 2007, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -25,6 +25,7 @@ public class PreferenceModifyListener extends // Nothing to do } + @Override public IEclipsePreferences preApply(IEclipsePreferences node){ // the node does not need to be the root of the hierarchy Preferences root=node.node("/"); //$NON-NLS-1$ diff --git a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/ResponsiveSocketFactory.java b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/ResponsiveSocketFactory.java index 3f93d8fe6..c224e4bd5 100644 --- a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/ResponsiveSocketFactory.java +++ b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/ResponsiveSocketFactory.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2018 IBM Corporation and others. + * Copyright (c) 2007, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -37,16 +37,19 @@ public class ResponsiveSocketFactory implements SocketFactory { this.monitor = monitor; this.timeout=timeout; } + @Override public InputStream getInputStream(Socket socket) throws IOException { if (in == null) in = socket.getInputStream(); return in; } + @Override public OutputStream getOutputStream(Socket socket) throws IOException { if (out == null) out = socket.getOutputStream(); return out; } + @Override public Socket createSocket(String host, int port) throws IOException, UnknownHostException { Socket socket = null; socket = createSocket(host, port, timeout / 1000, monitor); diff --git a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/UserInfoImpl.java b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/UserInfoImpl.java index db2429a4d..482ee292d 100644 --- a/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/UserInfoImpl.java +++ b/bundles/org.eclipse.jsch.core/src/org/eclipse/jsch/internal/core/UserInfoImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2007 IBM Corporation and others. + * Copyright (c) 2000, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -49,14 +49,17 @@ class UserInfoImpl implements com.jcraft.jsch.UserInfo, UIKeyboardInteractive{ this.timeout=timeout; } + @Override public String getPassword(){ return password; } + @Override public String getPassphrase(){ return passphrase; } + @Override public boolean promptYesNo(String str){ int prompt=authenticator.prompt(location, IUserAuthenticator.QUESTION, Messages.JSchSession_5, str, new int[] {IUserAuthenticator.YES_ID, @@ -69,18 +72,22 @@ class UserInfoImpl implements com.jcraft.jsch.UserInfo, UIKeyboardInteractive{ final String[] _password=new String[1]; final String username=location.getUsername(); IUserInfo info=new IUserInfo(){ + @Override public String getUsername(){ return username; } + @Override public boolean isUsernameMutable(){ return false; } + @Override public void setPassword(String password){ _password[0]=password; } + @Override public void setUsername(String username){ // } @@ -95,6 +102,7 @@ class UserInfoImpl implements com.jcraft.jsch.UserInfo, UIKeyboardInteractive{ return _password[0]; } + @Override public boolean promptPassphrase(String message){ try{ startTimer(); @@ -114,6 +122,7 @@ class UserInfoImpl implements com.jcraft.jsch.UserInfo, UIKeyboardInteractive{ } } + @Override public boolean promptPassword(String message){ try{ startTimer(); @@ -132,12 +141,14 @@ class UserInfoImpl implements com.jcraft.jsch.UserInfo, UIKeyboardInteractive{ } } + @Override public void showMessage(String message){ authenticator.prompt(location, IUserAuthenticator.INFORMATION, Messages.JSchSession_5, message, new int[] {IUserAuthenticator.OK_ID}, IUserAuthenticator.OK_ID); } + @Override public String[] promptKeyboardInteractive(String destination, String name, String instruction, String[] prompt, boolean[] echo){ if(prompt.length==0){ |