Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 79228 Details for
Bug 203490
[ssh] NPE in SftpFileService.getUserHome()
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
New patch (overriding the old one)
patch203490_getUserHome.diff.txt (text/plain), 3.93 KB, created by
Martin Oberhuber
on 2007-09-26 14:44:01 EDT
(
hide
)
Description:
New patch (overriding the old one)
Filename:
MIME Type:
Creator:
Martin Oberhuber
Created:
2007-09-26 14:44:01 EDT
Size:
3.93 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.rse.services.ssh >Index: src/org/eclipse/rse/internal/services/ssh/files/SftpFileService.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.ssh/src/org/eclipse/rse/internal/services/ssh/files/SftpFileService.java,v >retrieving revision 1.22 >diff -u -r1.22 SftpFileService.java >--- src/org/eclipse/rse/internal/services/ssh/files/SftpFileService.java 14 Sep 2007 20:51:42 -0000 1.22 >+++ src/org/eclipse/rse/internal/services/ssh/files/SftpFileService.java 26 Sep 2007 18:41:02 -0000 >@@ -64,7 +64,7 @@ > public class SftpFileService extends AbstractFileService implements IFileService, ISshService > { > >- private class SftpBufferedInputStream extends BufferedInputStream { >+ private static class SftpBufferedInputStream extends BufferedInputStream { > > private ChannelSftp channel; > >@@ -99,7 +99,7 @@ > } > } > >- private class SftpBufferedOutputStream extends BufferedOutputStream { >+ private static class SftpBufferedOutputStream extends BufferedOutputStream { > > private ChannelSftp channel; > >@@ -574,7 +574,7 @@ > } > > public IHostFile getUserHome() { >- //TODO Assert: this is only called after we are connected >+ //As per bug 204710, this may be called before we are connected > if (fUserHome!=null) { > int lastSlash = fUserHome.lastIndexOf('/'); > String name = fUserHome.substring(lastSlash + 1); >@@ -582,12 +582,15 @@ > try { > return getFile(parent, name, null); > } catch(SystemMessageException e) { >- //Error getting user home -> return a default below >+ //Error getting user home -> return a handle >+ //Returning the home path as a Root is the safest we can do, since it will >+ //let users know what the home path is, and the "My Home" filter will be >+ //set to correct target. See also bug 204710. >+ return new SftpHostFile("", fUserHome, true, true, false, 0, 0); //$NON-NLS-1$ > } > } >- //Could not determine user home >- //return new SftpHostFile(".",".",true,false,false,0,0); //$NON-NLS-1$ //$NON-NLS-2$ >- return new SftpHostFile("/", "/", true, true, false, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ >+ //Bug 203490, bug 204710: Could not determine user home >+ return null; > } > > public IHostFile[] getRoots(IProgressMonitor monitor) { >#P org.eclipse.rse.services.files.ftp >Index: src/org/eclipse/rse/internal/services/files/ftp/FTPService.java >=================================================================== >RCS file: /cvsroot/dsdp/org.eclipse.tm.rse/plugins/org.eclipse.rse.services.files.ftp/src/org/eclipse/rse/internal/services/files/ftp/FTPService.java,v >retrieving revision 1.38 >diff -u -r1.38 FTPService.java >--- src/org/eclipse/rse/internal/services/files/ftp/FTPService.java 26 Sep 2007 13:24:50 -0000 1.38 >+++ src/org/eclipse/rse/internal/services/files/ftp/FTPService.java 26 Sep 2007 18:41:03 -0000 >@@ -60,6 +60,7 @@ > * Javier Montalvo Orus (Symbian) - [199243] Renaming a file in an FTP-based EFS folder hangs all of Eclipse > * Martin Oberhuber (Wind River) - [203306] Fix Deadlock comparing two files on FTP > * Martin Oberhuber (Wind River) - [204669] Fix ftp path concatenation on systems using backslash separator >+ * Martin Oberhuber (Wind River) - [203490] Fix NPE in FTPService.getUserHome() > ********************************************************************************/ > > package org.eclipse.rse.internal.services.files.ftp; >@@ -888,9 +889,15 @@ > */ > public IHostFile getUserHome() > { >+ if (_userHome==null) { >+ //As per bug 204710, this may be called before we are connected. >+ //Returning null in this case is safest, see also SftpFileService. >+ return null; >+ } > return new FTPHostFile("",_userHome,true,true,0,0,true); //$NON-NLS-1$ > } > >+ > /* > * (non-Javadoc) > * @see org.eclipse.rse.services.files.IFileService#getRoots(org.eclipse.core.runtime.IProgressMonitor)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 203490
:
78471
| 79228