View | Details | Raw Unified | Return to bug 203490 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/rse/internal/services/ssh/files/SftpFileService.java (-7 / +10 lines)
Lines 64-70 Link Here
64
public class SftpFileService extends AbstractFileService implements IFileService, ISshService
64
public class SftpFileService extends AbstractFileService implements IFileService, ISshService
65
{
65
{
66
66
67
	private class SftpBufferedInputStream extends BufferedInputStream {
67
	private static class SftpBufferedInputStream extends BufferedInputStream {
68
		
68
		
69
		private ChannelSftp channel;
69
		private ChannelSftp channel;
70
		
70
		
Lines 99-105 Link Here
99
		}
99
		}
100
	}
100
	}
101
	
101
	
102
	private class SftpBufferedOutputStream extends BufferedOutputStream {
102
	private static class SftpBufferedOutputStream extends BufferedOutputStream {
103
		
103
		
104
		private ChannelSftp channel;
104
		private ChannelSftp channel;
105
		
105
		
Lines 574-580 Link Here
574
	}
574
	}
575
	
575
	
576
	public IHostFile getUserHome() {
576
	public IHostFile getUserHome() {
577
		//TODO Assert: this is only called after we are connected
577
		//As per bug 204710, this may be called before we are connected
578
		if (fUserHome!=null) {
578
		if (fUserHome!=null) {
579
			int lastSlash = fUserHome.lastIndexOf('/');
579
			int lastSlash = fUserHome.lastIndexOf('/');
580
			String name = fUserHome.substring(lastSlash + 1);	
580
			String name = fUserHome.substring(lastSlash + 1);	
Lines 582-593 Link Here
582
			try {
582
			try {
583
				return getFile(parent, name, null);
583
				return getFile(parent, name, null);
584
			} catch(SystemMessageException e) {
584
			} catch(SystemMessageException e) {
585
				//Error getting user home -> return a default below
585
				//Error getting user home -> return a handle
586
				//Returning the home path as a Root is the safest we can do, since it will
587
				//let users know what the home path is, and the "My Home" filter will be
588
				//set to correct target. See also bug 204710.
589
				return new SftpHostFile("", fUserHome, true, true, false, 0, 0); //$NON-NLS-1$
586
			}
590
			}
587
		}
591
		}
588
		//Could not determine user home
592
		//Bug 203490, bug 204710: Could not determine user home
589
		//return new SftpHostFile(".",".",true,false,false,0,0); //$NON-NLS-1$ //$NON-NLS-2$
593
		return null;
590
		return new SftpHostFile("/", "/", true, true, false, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$
591
	}
594
	}
592
595
593
	public IHostFile[] getRoots(IProgressMonitor monitor) {
596
	public IHostFile[] getRoots(IProgressMonitor monitor) {
(-)src/org/eclipse/rse/internal/services/files/ftp/FTPService.java (+7 lines)
Lines 60-65 Link Here
60
 * Javier Montalvo Orus (Symbian) - [199243] Renaming a file in an FTP-based EFS folder hangs all of Eclipse
60
 * Javier Montalvo Orus (Symbian) - [199243] Renaming a file in an FTP-based EFS folder hangs all of Eclipse
61
 * Martin Oberhuber (Wind River) - [203306] Fix Deadlock comparing two files on FTP
61
 * Martin Oberhuber (Wind River) - [203306] Fix Deadlock comparing two files on FTP
62
 * Martin Oberhuber (Wind River) - [204669] Fix ftp path concatenation on systems using backslash separator
62
 * Martin Oberhuber (Wind River) - [204669] Fix ftp path concatenation on systems using backslash separator
63
 * Martin Oberhuber (Wind River) - [203490] Fix NPE in FTPService.getUserHome()
63
 ********************************************************************************/
64
 ********************************************************************************/
64
65
65
package org.eclipse.rse.internal.services.files.ftp;
66
package org.eclipse.rse.internal.services.files.ftp;
Lines 888-896 Link Here
888
	 */
889
	 */
889
	public IHostFile getUserHome()
890
	public IHostFile getUserHome()
890
	{
891
	{
892
		if (_userHome==null) {
893
			//As per bug 204710, this may be called before we are connected.
894
			//Returning null in this case is safest, see also SftpFileService.
895
			return null;
896
		}
891
		return new FTPHostFile("",_userHome,true,true,0,0,true); //$NON-NLS-1$
897
		return new FTPHostFile("",_userHome,true,true,0,0,true); //$NON-NLS-1$
892
	}
898
	}
893
899
900
894
	/*
901
	/*
895
	 * (non-Javadoc)
902
	 * (non-Javadoc)
896
	 * @see org.eclipse.rse.services.files.IFileService#getRoots(org.eclipse.core.runtime.IProgressMonitor)
903
	 * @see org.eclipse.rse.services.files.IFileService#getRoots(org.eclipse.core.runtime.IProgressMonitor)

Return to bug 203490