1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-15 04:55:22 +02:00

[199854][api] Improve error reporting for archive handlers

This commit is contained in:
Martin Oberhuber 2008-05-07 03:56:37 +00:00
parent 70ada1aa61
commit 9fedb82d9e
4 changed files with 152 additions and 180 deletions

View file

@ -83,6 +83,7 @@ import org.eclipse.rse.services.clientserver.messages.ICommonMessageIds;
import org.eclipse.rse.services.clientserver.messages.SimpleSystemMessage; 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.SystemMessageException; import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.services.clientserver.messages.SystemOperationCancelledException;
import org.eclipse.rse.services.files.AbstractFileService; import org.eclipse.rse.services.files.AbstractFileService;
import org.eclipse.rse.services.files.HostFilePermissions; import org.eclipse.rse.services.files.HostFilePermissions;
import org.eclipse.rse.services.files.IFilePermissionsService; import org.eclipse.rse.services.files.IFilePermissionsService;
@ -90,7 +91,6 @@ import org.eclipse.rse.services.files.IFileService;
import org.eclipse.rse.services.files.IHostFile; import org.eclipse.rse.services.files.IHostFile;
import org.eclipse.rse.services.files.IHostFilePermissions; import org.eclipse.rse.services.files.IHostFilePermissions;
import org.eclipse.rse.services.files.IHostFilePermissionsContainer; import org.eclipse.rse.services.files.IHostFilePermissionsContainer;
import org.eclipse.rse.services.files.RemoteFileCancelledException;
import org.eclipse.rse.services.files.RemoteFileException; import org.eclipse.rse.services.files.RemoteFileException;
import org.eclipse.rse.services.files.RemoteFileIOException; import org.eclipse.rse.services.files.RemoteFileIOException;
import org.eclipse.rse.services.files.RemoteFileSecurityException; import org.eclipse.rse.services.files.RemoteFileSecurityException;
@ -322,15 +322,13 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
} }
} }
catch (FileNotFoundException e) catch (SystemMessageException e)
{ {
throw e;
} }
catch (UnsupportedEncodingException e) catch (Exception e)
{ {
} throw new RemoteFileIOException(Activator.PLUGIN_ID, e);
catch (IOException e)
{
e.printStackTrace();
} }
finally finally
{ {
@ -348,8 +346,7 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
if (isCancelled) if (isCancelled)
{ {
// TODO inspect this throw new SystemOperationCancelledException();
throw new RemoteFileCancelledException();
} }
} }
catch (IOException e) catch (IOException e)
@ -387,16 +384,11 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
try try
{ {
if (!destinationFile.exists()) if (!destinationFile.exists())
{ {
File parentDir = destinationFile.getParentFile(); File parentDir = destinationFile.getParentFile();
parentDir.mkdirs(); parentDir.mkdirs();
} }
// encoding conversion required if it a text file but not an xml file // encoding conversion required if it a text file but not an xml file
boolean isEncodingConversionRequired = !isBinary; boolean isEncodingConversionRequired = !isBinary;
@ -453,22 +445,9 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
} }
} }
} }
catch (FileNotFoundException e) catch (Exception e)
{ {
// SystemPlugin.logError("Local copy: " + file.getAbsolutePath(), e); throw new RemoteFileIOException(Activator.PLUGIN_ID, e);
throw new RemoteFileIOException(e);
}
catch (UnsupportedEncodingException e)
{
// SystemPlugin.logError("Local copy: " + file.getAbsolutePath(), e);
throw new RemoteFileIOException(e);
// return false;
}
catch (IOException e)
{
// SystemPlugin.logError("Local copy: " + file.getAbsolutePath(), e);
throw new RemoteFileIOException(e);
// return false;
} }
finally finally
{ {
@ -486,14 +465,14 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
if (isCancelled) if (isCancelled)
{ {
throw new RemoteFileCancelledException(); throw new SystemOperationCancelledException();
// return false; // return false;
} else if (file.exists()) { } else if (file.exists()) {
destinationFile.setLastModified(file.lastModified()); destinationFile.setLastModified(file.lastModified());
//TODO check if we want to preserve permissions //TODO check if we want to preserve permissions
//if(!file.canWrite()) destinationFile.setReadOnly(); //if(!file.canWrite()) destinationFile.setReadOnly();
if (destinationFile.length() != file.length()) { if (destinationFile.length() != file.length()) {
throw new RemoteFileCancelledException(); throw new SystemOperationCancelledException();
// System.err.println("local.upload: size mismach on "+destinationFile.getAbsolutePath()); //$NON-NLS-1$ // System.err.println("local.upload: size mismach on "+destinationFile.getAbsolutePath()); //$NON-NLS-1$
// return false; // return false;
} }
@ -509,8 +488,6 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
private boolean copyToArchive(File file, File destination, String newName, IProgressMonitor monitor, String sourceEncoding, String targetEncoding, boolean isText) throws SystemMessageException private boolean copyToArchive(File file, File destination, String newName, IProgressMonitor monitor, String sourceEncoding, String targetEncoding, boolean isText) throws SystemMessageException
{ {
boolean ok = false;
ISystemArchiveHandler handler = null; ISystemArchiveHandler handler = null;
String path = ""; //$NON-NLS-1$ String path = ""; //$NON-NLS-1$
if (ArchiveHandlerManager.isVirtual(destination.getAbsolutePath())) if (ArchiveHandlerManager.isVirtual(destination.getAbsolutePath()))
@ -539,17 +516,13 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
checkArchiveOperationStatusThread.start(); checkArchiveOperationStatusThread.start();
} }
if (file.isDirectory()) try {
{ if (file.isDirectory()) {
ok = handler.add(file, path, newName, sourceEncoding, targetEncoding, _fileTypeRegistry, archiveOperationMonitor); handler.add(file, path, newName, sourceEncoding, targetEncoding, _fileTypeRegistry, archiveOperationMonitor);
} else {
handler.add(file, path, newName, sourceEncoding, targetEncoding, isText, archiveOperationMonitor);
} }
else } catch (SystemMessageException e) {
{
ok = handler.add(file, path, newName, sourceEncoding, targetEncoding, isText, archiveOperationMonitor);
}
if (!ok)
{
if (null != monitor && monitor.isCanceled()) if (null != monitor && monitor.isCanceled())
{ {
//This operation has been cancelled by the user. //This operation has been cancelled by the user.
@ -557,13 +530,12 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
} }
// SystemPlugin.logError("LocalFileSubSystemImpl.copyToArchive(): Handler's add() method returned false."); // SystemPlugin.logError("LocalFileSubSystemImpl.copyToArchive(): Handler's add() method returned false.");
String msgTxt = NLS.bind(LocalServiceResources.FILEMSG_FILE_NOT_SAVED, destination.getName(), "localhost"); //$NON-NLS-1$ String msgTxt = NLS.bind(LocalServiceResources.FILEMSG_FILE_NOT_SAVED, destination.getName(), "localhost"); //$NON-NLS-1$
String msgDetails = LocalServiceResources.FILEMSG_FILE_NOT_SAVED_DETAILS; //String msgDetails = LocalServiceResources.FILEMSG_FILE_NOT_SAVED_DETAILS;
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
ILocalMessageIds.FILEMSG_FILE_NOT_SAVED, ILocalMessageIds.FILEMSG_FILE_NOT_SAVED,
IStatus.ERROR, msgTxt, msgDetails); IStatus.ERROR, msgTxt, e);
throw new SystemMessageException(msg); throw new SystemMessageException(msg);
} }
else
return true; return true;
} }
@ -675,7 +647,7 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
if (isCancelled) if (isCancelled)
{ {
throw new RemoteFileCancelledException(); throw new SystemOperationCancelledException();
// return false; // return false;
} else if (destinationFile!=null) { } else if (destinationFile!=null) {
destinationFile.setLastModified(localFile.lastModified()); destinationFile.setLastModified(localFile.lastModified());
@ -684,7 +656,7 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
// File lengths can be different if the encodings are different // File lengths can be different if the encodings are different
/* if (destinationFile.length() != localFile.length()) { /* if (destinationFile.length() != localFile.length()) {
// throw new RemoteFileCancelledException(); // throw new SystemOperationCancelledException();
System.err.println("local.upload: size mismach on "+destinationFile.getAbsolutePath()); //$NON-NLS-1$ System.err.println("local.upload: size mismach on "+destinationFile.getAbsolutePath()); //$NON-NLS-1$
return false; return false;
}*/ }*/
@ -696,7 +668,7 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
} }
} }
protected IHostFile[] internalFetch(String remoteParent, String fileFilter, int type, IProgressMonitor monitor) { protected IHostFile[] internalFetch(String remoteParent, String fileFilter, int type, IProgressMonitor monitor) throws SystemMessageException {
LocalFileNameFilter fFilter = new LocalFileNameFilter(fileFilter, type); LocalFileNameFilter fFilter = new LocalFileNameFilter(fileFilter, type);
File localParent = new File(remoteParent); File localParent = new File(remoteParent);
boolean isArchive = false; boolean isArchive = false;
@ -723,7 +695,6 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
isVirtual = ArchiveHandlerManager.isVirtual(remoteParent); isVirtual = ArchiveHandlerManager.isVirtual(remoteParent);
} }
if (isVirtual || isArchive) { if (isVirtual || isArchive) {
try {
VirtualChild[] contents = null; VirtualChild[] contents = null;
File theFile = getContainingArchive(localParent); File theFile = getContainingArchive(localParent);
if (isArchive) { if (isArchive) {
@ -740,13 +711,10 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
results[i] = new LocalVirtualHostFile(contents[i]); results[i] = new LocalVirtualHostFile(contents[i]);
} }
return results; return results;
} catch (IOException e) {
return null;
}
} else { } else {
// allow cancel before doing the os query // allow cancel before doing the os query
if (monitor != null && monitor.isCanceled()) { if (monitor != null && monitor.isCanceled()) {
return null; throw new SystemOperationCancelledException();
} }
/* bug 220241 - don't need this block of code /* bug 220241 - don't need this block of code
* listFiles() with a filter will still return all folders (they don't have to match) * listFiles() with a filter will still return all folders (they don't have to match)
@ -846,7 +814,7 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
public IHostFile getFile(String remoteParent, String name, IProgressMonitor monitor) public IHostFile getFile(String remoteParent, String name, IProgressMonitor monitor) throws SystemMessageException
{ {
if (name.endsWith(ArchiveHandlerManager.VIRTUAL_SEPARATOR)) if (name.endsWith(ArchiveHandlerManager.VIRTUAL_SEPARATOR))
{ {
@ -909,12 +877,13 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
fileToCreate.createNewFile(); fileToCreate.createNewFile();
if (ArchiveHandlerManager.getInstance().isArchive(fileToCreate)) if (ArchiveHandlerManager.getInstance().isArchive(fileToCreate))
{ {
if (!ArchiveHandlerManager.getInstance().createEmptyArchive(fileToCreate)) try {
{ ArchiveHandlerManager.getInstance().createEmptyArchive(fileToCreate);
} catch (SystemMessageException e) {
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
ILocalMessageIds.FILEMSG_ARCHIVE_CORRUPTED, ILocalMessageIds.FILEMSG_ARCHIVE_CORRUPTED,
IStatus.ERROR, IStatus.ERROR,
LocalServiceResources.FILEMSG_ARCHIVE_CORRUPTED, LocalServiceResources.FILEMSG_ARCHIVE_CORRUPTED_DETAILS); LocalServiceResources.FILEMSG_ARCHIVE_CORRUPTED, e);
throw new SystemMessageException(msg); throw new SystemMessageException(msg);
} }
} }
@ -947,21 +916,19 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
CheckArchiveOperationStatusThread checkArchiveOperationStatusThread = new CheckArchiveOperationStatusThread(archiveOperationMonitor, monitor); CheckArchiveOperationStatusThread checkArchiveOperationStatusThread = new CheckArchiveOperationStatusThread(archiveOperationMonitor, monitor);
checkArchiveOperationStatusThread.start(); checkArchiveOperationStatusThread.start();
} }
boolean ok = handler.createFile(child.fullName, archiveOperationMonitor); try {
handler.createFile(child.fullName, archiveOperationMonitor);
if (!ok) } catch (SystemMessageException e) {
{
if (null != monitor && monitor.isCanceled()) if (null != monitor && monitor.isCanceled())
{ {
//This operation has been cancelled by the user. //This operation has been cancelled by the user.
throw getCancelledException(); throw getCancelledException();
} }
String msgTxt = NLS.bind(LocalServiceResources.FILEMSG_CREATE_VIRTUAL_FAILED, newFile); String msgTxt = NLS.bind(LocalServiceResources.FILEMSG_CREATE_VIRTUAL_FAILED, newFile);
String msgDetails = LocalServiceResources.FILEMSG_CREATE_VIRTUAL_FAILED_DETAILS; //String msgDetails = LocalServiceResources.FILEMSG_CREATE_VIRTUAL_FAILED_DETAILS;
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
ILocalMessageIds.FILEMSG_CREATE_VIRTUAL_FAILED, ILocalMessageIds.FILEMSG_CREATE_VIRTUAL_FAILED,
IStatus.ERROR, msgTxt, msgDetails); IStatus.ERROR, msgTxt, e);
throw new SystemMessageException(msg); throw new SystemMessageException(msg);
} }
} }
@ -1027,10 +994,9 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
CheckArchiveOperationStatusThread checkArchiveOperationStatusThread = new CheckArchiveOperationStatusThread(archiveOperationMonitor, monitor); CheckArchiveOperationStatusThread checkArchiveOperationStatusThread = new CheckArchiveOperationStatusThread(archiveOperationMonitor, monitor);
checkArchiveOperationStatusThread.start(); checkArchiveOperationStatusThread.start();
} }
boolean ok = handler.createFolder(child.fullName, archiveOperationMonitor); try {
handler.createFolder(child.fullName, archiveOperationMonitor);
if (!ok) } catch (SystemMessageException e) {
{
if (null != monitor && monitor.isCanceled()) if (null != monitor && monitor.isCanceled())
{ {
//This operation has been cancelled by the user. //This operation has been cancelled by the user.
@ -1038,11 +1004,12 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
} }
String msgTxt = NLS.bind(LocalServiceResources.FILEMSG_CREATE_VIRTUAL_FAILED, newFolder); String msgTxt = NLS.bind(LocalServiceResources.FILEMSG_CREATE_VIRTUAL_FAILED, newFolder);
String msgDetails = LocalServiceResources.FILEMSG_CREATE_VIRTUAL_FAILED_DETAILS; //String msgDetails = LocalServiceResources.FILEMSG_CREATE_VIRTUAL_FAILED_DETAILS;
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
ILocalMessageIds.FILEMSG_CREATE_VIRTUAL_FAILED, ILocalMessageIds.FILEMSG_CREATE_VIRTUAL_FAILED,
IStatus.ERROR, msgTxt, msgDetails); IStatus.ERROR, msgTxt, e);
throw new SystemMessageException(msg); throw new SystemMessageException(msg);
} }
} }
return new LocalVirtualHostFile(child); return new LocalVirtualHostFile(child);
@ -1209,9 +1176,9 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
checkArchiveOperationStatusThread.start(); checkArchiveOperationStatusThread.start();
} }
boolean retval = handler.rename(child.fullName, newName, archiveOperationMonitor); try {
if (!retval) handler.rename(child.fullName, newName, archiveOperationMonitor);
{ } catch (SystemMessageException e) {
if (null != monitor && monitor.isCanceled()) if (null != monitor && monitor.isCanceled())
{ {
//This operation has been cancelled by the user. //This operation has been cancelled by the user.
@ -1220,12 +1187,12 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
// for 192705, we need to throw an exception when rename fails // for 192705, we need to throw an exception when rename fails
String msgTxt = NLS.bind(LocalServiceResources.FILEMSG_RENAME_FILE_FAILED, child.fullName); String msgTxt = NLS.bind(LocalServiceResources.FILEMSG_RENAME_FILE_FAILED, child.fullName);
String msgDetails = LocalServiceResources.FILEMSG_RENAME_FILE_FAILED_DETAILS; //String msgDetails = LocalServiceResources.FILEMSG_RENAME_FILE_FAILED_DETAILS;
throw new SystemMessageException(new SimpleSystemMessage(Activator.PLUGIN_ID, throw new SystemMessageException(new SimpleSystemMessage(Activator.PLUGIN_ID,
ILocalMessageIds.FILEMSG_RENAME_FILE_FAILED, ILocalMessageIds.FILEMSG_RENAME_FILE_FAILED,
IStatus.ERROR, msgTxt, msgDetails)); IStatus.ERROR,
msgTxt, e));
} }
return retval;
} }
return false; return false;
} }
@ -1413,9 +1380,9 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
checkArchiveOperationStatusThread.start(); checkArchiveOperationStatusThread.start();
} }
File destinationFile = new File(targetFolder, child.name); File destinationFile = new File(targetFolder, child.name);
boolean returnValue = child.getExtractedFile(destinationFile, sourceEncoding, isText, archiveOperationMonitor); try {
if (!returnValue) child.getExtractedFile(destinationFile, sourceEncoding, isText, archiveOperationMonitor);
{ } catch (SystemMessageException e) {
if (destinationFile.isDirectory()) if (destinationFile.isDirectory())
{ {
deleteContents(destinationFile, monitor); deleteContents(destinationFile, monitor);
@ -1433,12 +1400,12 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
// for 192705, we need to throw an exception when rename fails // for 192705, we need to throw an exception when rename fails
String msgTxt = NLS.bind(LocalServiceResources.FILEMSG_RENAME_FILE_FAILED, child.fullName); String msgTxt = NLS.bind(LocalServiceResources.FILEMSG_RENAME_FILE_FAILED, child.fullName);
String msgDetails = LocalServiceResources.FILEMSG_RENAME_FILE_FAILED_DETAILS; //String msgDetails = LocalServiceResources.FILEMSG_RENAME_FILE_FAILED_DETAILS;
throw new SystemMessageException(new SimpleSystemMessage(Activator.PLUGIN_ID, throw new SystemMessageException(new SimpleSystemMessage(Activator.PLUGIN_ID,
ILocalMessageIds.FILEMSG_RENAME_FILE_FAILED, ILocalMessageIds.FILEMSG_RENAME_FILE_FAILED,
IStatus.ERROR, msgTxt, msgDetails)); IStatus.ERROR,
msgTxt, e));
} }
return returnValue;
} }
if (null != monitor) if (null != monitor)

View file

@ -22,6 +22,7 @@ import java.io.File;
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager; import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
import org.eclipse.rse.services.clientserver.archiveutils.VirtualChild; import org.eclipse.rse.services.clientserver.archiveutils.VirtualChild;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
public class LocalVirtualHostFile extends LocalHostFile public class LocalVirtualHostFile extends LocalHostFile
{ {
@ -67,7 +68,11 @@ public class LocalVirtualHostFile extends LocalHostFile
public boolean exists() public boolean exists()
{ {
try {
return _child.exists(); return _child.exists();
} catch (SystemMessageException e) {
return false;
}
} }
public String getAbsolutePath() public String getAbsolutePath()

View file

@ -37,6 +37,7 @@ import org.eclipse.rse.services.clientserver.SystemSearchString;
import org.eclipse.rse.services.clientserver.archiveutils.AbsoluteVirtualPath; import org.eclipse.rse.services.clientserver.archiveutils.AbsoluteVirtualPath;
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager; import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
import org.eclipse.rse.services.clientserver.archiveutils.VirtualChild; import org.eclipse.rse.services.clientserver.archiveutils.VirtualChild;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.services.clientserver.search.SystemSearchFileNameMatcher; import org.eclipse.rse.services.clientserver.search.SystemSearchFileNameMatcher;
import org.eclipse.rse.services.clientserver.search.SystemSearchLineMatch; import org.eclipse.rse.services.clientserver.search.SystemSearchLineMatch;
import org.eclipse.rse.services.clientserver.search.SystemSearchMatch; import org.eclipse.rse.services.clientserver.search.SystemSearchMatch;
@ -149,16 +150,16 @@ public class LocalSearchHandler implements ISearchHandler
// start search // start search
// pass in the context of the target file // pass in the context of the target file
try {
internalSearch(_theFile, _depth, _theRmtFile); internalSearch(_theFile, _depth, _theRmtFile);
_isDone = true; _isDone = true;
if (!_isCancelled) {
if (!_isCancelled)
{
_searchConfig.setStatus(IHostSearchConstants.FINISHED); _searchConfig.setStatus(IHostSearchConstants.FINISHED);
} else {
_searchConfig.setStatus(IHostSearchConstants.CANCELLED);
} }
else } catch (SystemMessageException e) {
{ _isDone = false;
_searchConfig.setStatus(IHostSearchConstants.CANCELLED); _searchConfig.setStatus(IHostSearchConstants.CANCELLED);
} }
} }
@ -185,7 +186,7 @@ public class LocalSearchHandler implements ISearchHandler
} }
} }
private boolean internalSearch(File theFile, int depth, IHostFile context) private boolean internalSearch(File theFile, int depth, IHostFile context) throws SystemMessageException
{ {
boolean foundFile = false; boolean foundFile = false;
@ -337,15 +338,7 @@ public class LocalSearchHandler implements ISearchHandler
VirtualChild[] virtualchildren = null; VirtualChild[] virtualchildren = null;
try
{
virtualchildren = ArchiveHandlerManager.getInstance().getContents(archive, virtualPath); virtualchildren = ArchiveHandlerManager.getInstance().getContents(archive, virtualPath);
}
catch (IOException e)
{
//SystemPlugin.logError("An erorr occured trying to retrieve virtual file " + virtualPath
// + " for " + archive.getAbsolutePath(), e);
}
if (virtualchildren != null) if (virtualchildren != null)
{ {
@ -463,9 +456,8 @@ public class LocalSearchHandler implements ISearchHandler
/** /**
* Returns whether classification matches. * Returns whether classification matches.
* *
* @param absolutePath * @param absolutePath the absolute path of the file for which we want to
* the absolute path of the file for which we want to check * check classification.
* classification.
* @return <code>true</code> if the classification matches, * @return <code>true</code> if the classification matches,
* <code>false</code> otherwise. * <code>false</code> otherwise.
*/ */

View file

@ -21,9 +21,12 @@ package org.eclipse.rse.internal.subsystems.files.local.model;
import java.io.File; import java.io.File;
import org.eclipse.rse.core.model.ISystemMessageObject;
import org.eclipse.rse.core.model.SystemMessageObject;
import org.eclipse.rse.internal.services.local.files.LocalVirtualHostFile; import org.eclipse.rse.internal.services.local.files.LocalVirtualHostFile;
import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager; import org.eclipse.rse.services.clientserver.archiveutils.ArchiveHandlerManager;
import org.eclipse.rse.services.clientserver.archiveutils.VirtualChild; import org.eclipse.rse.services.clientserver.archiveutils.VirtualChild;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem; import org.eclipse.rse.subsystems.files.core.servicesubsystem.FileServiceSubSystem;
import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext; import org.eclipse.rse.subsystems.files.core.subsystems.IRemoteFileContext;
import org.eclipse.rse.subsystems.files.core.subsystems.IVirtualRemoteFile; import org.eclipse.rse.subsystems.files.core.subsystems.IVirtualRemoteFile;
@ -168,7 +171,12 @@ public class LocalVirtualFile extends LocalFile implements IVirtualRemoteFile
public Object getFile(String srcEncoding, boolean isText) public Object getFile(String srcEncoding, boolean isText)
{ {
try {
return _node.getChild().getExtractedFile(srcEncoding, isText, null); return _node.getChild().getExtractedFile(srcEncoding, isText, null);
} catch (SystemMessageException e) {
//FIXME check if this is OK, or should we better return null?
return new SystemMessageObject(e.getSystemMessage(), ISystemMessageObject.MSGTYPE_ERROR, null);
}
} }
public String getContainingArchiveFullName() public String getContainingArchiveFullName()