mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-14 20:45:22 +02:00
[203490] Fix NPE in SftpService.getUserHome()
This commit is contained in:
parent
8867e6ee8b
commit
557e3d6417
1 changed files with 13 additions and 9 deletions
|
@ -13,6 +13,7 @@
|
||||||
* Martin Oberhuber (Wind River) - [192724] Fixed logic to filter folders if FILE_TYPE_FOLDERS
|
* Martin Oberhuber (Wind River) - [192724] Fixed logic to filter folders if FILE_TYPE_FOLDERS
|
||||||
* Martin Oberhuber (Wind River) - [199548] Avoid touching files on setReadOnly() if unnecessary
|
* Martin Oberhuber (Wind River) - [199548] Avoid touching files on setReadOnly() if unnecessary
|
||||||
* Benjamin Muskalla (b.muskalla@gmx.net) - [174690][ssh] cannot delete symbolic links on remote systems
|
* Benjamin Muskalla (b.muskalla@gmx.net) - [174690][ssh] cannot delete symbolic links on remote systems
|
||||||
|
* Martin Oberhuber (Wind River) - [203490] Fix NPE in SftpService.getUserHome()
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.services.ssh.files;
|
package org.eclipse.rse.internal.services.ssh.files;
|
||||||
|
@ -574,16 +575,19 @@ public class SftpFileService extends AbstractFileService implements IFileService
|
||||||
|
|
||||||
public IHostFile getUserHome() {
|
public IHostFile getUserHome() {
|
||||||
//TODO Assert: this is only called after we are connected
|
//TODO Assert: this is only called after we are connected
|
||||||
int lastSlash = fUserHome.lastIndexOf('/');
|
if (fUserHome!=null) {
|
||||||
String name = fUserHome.substring(lastSlash + 1);
|
int lastSlash = fUserHome.lastIndexOf('/');
|
||||||
String parent = fUserHome.substring(0, lastSlash);
|
String name = fUserHome.substring(lastSlash + 1);
|
||||||
try {
|
String parent = fUserHome.substring(0, lastSlash);
|
||||||
return getFile(parent, name, null);
|
try {
|
||||||
} catch(SystemMessageException e) {
|
return getFile(parent, name, null);
|
||||||
//Could not determine user home
|
} catch(SystemMessageException e) {
|
||||||
//return new SftpHostFile(".",".",true,false,false,0,0); //$NON-NLS-1$ //$NON-NLS-2$
|
//Error getting user home -> return a default below
|
||||||
return new SftpHostFile("/", "/", true, true, false, 0, 0); //$NON-NLS-1$ //$NON-NLS-2$
|
}
|
||||||
}
|
}
|
||||||
|
//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$
|
||||||
}
|
}
|
||||||
|
|
||||||
public IHostFile[] getRoots(IProgressMonitor monitor) {
|
public IHostFile[] getRoots(IProgressMonitor monitor) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue