mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-17 21:25:58 +02:00
[286129][api] RemoteFileException(String) violates API contract
This commit is contained in:
parent
9b9ab65317
commit
43af27a74a
3 changed files with 44 additions and 9 deletions
|
@ -43,6 +43,7 @@
|
||||||
* David McKnight (IBM) - [238367] [regression] Error when deleting Archive Files
|
* David McKnight (IBM) - [238367] [regression] Error when deleting Archive Files
|
||||||
* David McKnight (IBM) - [280899] RSE can't open files in some directory, which give the RSEG1067 error me
|
* David McKnight (IBM) - [280899] RSE can't open files in some directory, which give the RSEG1067 error me
|
||||||
* Martin Oberhuber (Wind River) - [285942] Throw exception when listing a non-folder
|
* Martin Oberhuber (Wind River) - [285942] Throw exception when listing a non-folder
|
||||||
|
* Martin Oberhuber (Wind River) - [286129][api] RemoteFileException(String) violates API contract
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.services.local.files;
|
package org.eclipse.rse.internal.services.local.files;
|
||||||
|
@ -739,7 +740,8 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
||||||
if (localParent.exists()) {
|
if (localParent.exists()) {
|
||||||
File[] files = localParent.listFiles(fFilter);
|
File[] files = localParent.listFiles(fFilter);
|
||||||
if (files == null) {
|
if (files == null) {
|
||||||
throw new RemoteFileException("Error listing: " + localParent.getAbsolutePath());
|
//throw new RemoteFileException("Error listing: " + localParent.getAbsolutePath());
|
||||||
|
throw new RemoteFileIOException(new IOException("Error listing: " + localParent.getAbsolutePath()));
|
||||||
}
|
}
|
||||||
return convertToHostFiles(files, type);
|
return convertToHostFiles(files, type);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
* David McKnight (IBM) - [272882] [api] Handle exceptions in IService.initService()
|
* David McKnight (IBM) - [272882] [api] Handle exceptions in IService.initService()
|
||||||
* Martin Oberhuber (Wind River) - [274568] Dont use SftpMonitor for Streams transfer
|
* Martin Oberhuber (Wind River) - [274568] Dont use SftpMonitor for Streams transfer
|
||||||
* Patrick Tassé (Ericsson) - [285226] Empty directory shown as an error message
|
* Patrick Tassé (Ericsson) - [285226] Empty directory shown as an error message
|
||||||
|
* Martin Oberhuber (Wind River) - [286129][api] RemoteFileException(String) violates API contract
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.internal.services.ssh.files;
|
package org.eclipse.rse.internal.services.ssh.files;
|
||||||
|
@ -556,7 +557,8 @@ public class SftpFileService extends AbstractFileService implements ISshService,
|
||||||
SftpATTRS attrs = getChannel("SftpFileService.internalFetch: " + parentPath).stat(parentPath); //$NON-NLS-1$
|
SftpATTRS attrs = getChannel("SftpFileService.internalFetch: " + parentPath).stat(parentPath); //$NON-NLS-1$
|
||||||
if (!attrs.isDir()) {
|
if (!attrs.isDir()) {
|
||||||
// parent was a file and not a folder
|
// parent was a file and not a folder
|
||||||
throw new RemoteFileException("Not a folder: " + parentPath); //$NON-NLS-1$
|
//throw new RemoteFileException("Not a folder: " + parentPath); //$NON-NLS-1$
|
||||||
|
throw new RemoteFileIOException(new IOException("Not a folder: " + parentPath)); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (filematcher.matches(fileName) || (lsEntry.getAttrs().isDir() && fileType!=IFileService.FILE_TYPE_FOLDERS)) {
|
if (filematcher.matches(fileName) || (lsEntry.getAttrs().isDir() && fileType!=IFileService.FILE_TYPE_FOLDERS)) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2008 IBM Corporation and others.
|
* Copyright (c) 2000, 2009 IBM Corporation and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -13,11 +13,18 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Martin Oberhuber (Wind River) - [226374] [api] Need default SystemMessageException specialisations
|
* Martin Oberhuber (Wind River) - [226374] [api] Need default SystemMessageException specialisations
|
||||||
|
* Martin Oberhuber (Wind River) - [286129][api] RemoteFileException(String) violates API contract
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.rse.services.files;
|
package org.eclipse.rse.services.files;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
|
import org.eclipse.rse.internal.services.Activator;
|
||||||
|
import org.eclipse.rse.internal.services.RSEServicesMessages;
|
||||||
|
import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage;
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
import org.eclipse.rse.services.clientserver.messages.SystemMessage;
|
||||||
import org.eclipse.rse.services.clientserver.messages.SystemRemoteMessageException;
|
import org.eclipse.rse.services.clientserver.messages.SystemRemoteMessageException;
|
||||||
|
|
||||||
|
@ -46,21 +53,32 @@ public class RemoteFileException extends SystemRemoteMessageException
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for RemoteFileException with an error message for getMessage() to return.
|
* Constructor for RemoteFileException with an error message for
|
||||||
|
* getMessage() to return.
|
||||||
|
*
|
||||||
* @param bundle The ResourceBundle containing the error message
|
* @param bundle The ResourceBundle containing the error message
|
||||||
* @param key The key to retrieve the message
|
* @param key The key to retrieve the message
|
||||||
|
* @deprecated this constructor violates the contract that all
|
||||||
|
* RemoteFileException instances must have an embedded remote
|
||||||
|
* exception for {@link #getRemoteException()} to return
|
||||||
*/
|
*/
|
||||||
public RemoteFileException(ResourceBundle bundle, String key)
|
public RemoteFileException(ResourceBundle bundle, String key)
|
||||||
{
|
{
|
||||||
this(getString(bundle,key), null);
|
this(getString(bundle, key));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for RemoteFileException with an error message for getMessage() to return.
|
* Constructor for RemoteFileException with an error message for
|
||||||
|
* getMessage() to return.
|
||||||
|
*
|
||||||
* @param msg The fully resolved message
|
* @param msg The fully resolved message
|
||||||
|
* @deprecated this constructor violates the contract that all
|
||||||
|
* RemoteFileException instances must have an embedded remote
|
||||||
|
* exception for {@link #getRemoteException()} to return
|
||||||
*/
|
*/
|
||||||
public RemoteFileException(String msg)
|
public RemoteFileException(String msg)
|
||||||
{
|
{
|
||||||
this(msg, null);
|
this(msg, new Exception(msg));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Constructor for RemoteFileException with an error message for getMessage() to return,
|
* Constructor for RemoteFileException with an error message for getMessage() to return,
|
||||||
|
@ -82,15 +100,28 @@ public class RemoteFileException extends SystemRemoteMessageException
|
||||||
public RemoteFileException(String msg, Exception remoteException)
|
public RemoteFileException(String msg, Exception remoteException)
|
||||||
{
|
{
|
||||||
super(msg, remoteException);
|
super(msg, remoteException);
|
||||||
|
String msgTxt = RSEServicesMessages.FILEMSG_OPERATION_FAILED;
|
||||||
|
if (remoteException != null && remoteException.getMessage() != null && !remoteException.getMessage().equals(msg)) {
|
||||||
|
msg = (msg == null) ? remoteException.getMessage() : msg + ": " + remoteException.getMessage();
|
||||||
|
}
|
||||||
|
String msgDetails = NLS.bind(RSEServicesMessages.FILEMSG_OPERATION_FAILED_DETAILS, msg);
|
||||||
|
SystemMessage myMessage = new SimpleSystemMessage(Activator.PLUGIN_ID, "RSEF1002", //$NON-NLS-1$
|
||||||
|
IStatus.ERROR, msgTxt, msgDetails);
|
||||||
|
setSystemMessage(myMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for RemoteFileException with an error message for getMessage() to return.
|
* Constructor for RemoteFileException with an error message for
|
||||||
|
* getMessage() to return.
|
||||||
|
*
|
||||||
* @param msg The fully resolved message
|
* @param msg The fully resolved message
|
||||||
|
* @deprecated this constructor violates the contract that all
|
||||||
|
* RemoteFileException instances must have an embedded remote
|
||||||
|
* exception for {@link #getRemoteException()} to return
|
||||||
*/
|
*/
|
||||||
public RemoteFileException(SystemMessage msg)
|
public RemoteFileException(SystemMessage msg)
|
||||||
{
|
{
|
||||||
this(msg, null);
|
this(msg, new Exception(msg.getLevelOneText()));
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Constructor for RemoteFileException with an error message for getMessage() to return.
|
* Constructor for RemoteFileException with an error message for getMessage() to return.
|
||||||
|
|
Loading…
Add table
Reference in a new issue