mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-03 23:25:26 +02:00
[199854] Fix regressions in unit tests
This commit is contained in:
parent
2699735729
commit
e00d3e5182
2 changed files with 35 additions and 19 deletions
|
@ -875,23 +875,20 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
try
|
||||
{
|
||||
fileToCreate.createNewFile();
|
||||
if (ArchiveHandlerManager.getInstance().isArchive(fileToCreate))
|
||||
{
|
||||
try {
|
||||
ArchiveHandlerManager.getInstance().createEmptyArchive(fileToCreate);
|
||||
} catch (SystemMessageException e) {
|
||||
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID,
|
||||
ILocalMessageIds.FILEMSG_ARCHIVE_CORRUPTED,
|
||||
IStatus.ERROR,
|
||||
LocalServiceResources.FILEMSG_ARCHIVE_CORRUPTED, e);
|
||||
throw new SystemMessageException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
catch (IOException e)
|
||||
{
|
||||
throw new RemoteFileSecurityException(e);
|
||||
}
|
||||
if (ArchiveHandlerManager.getInstance().isArchive(fileToCreate)) {
|
||||
try {
|
||||
ArchiveHandlerManager.getInstance().createEmptyArchive(fileToCreate);
|
||||
} catch (SystemMessageException e) {
|
||||
SystemMessage msg = new SimpleSystemMessage(Activator.PLUGIN_ID, ILocalMessageIds.FILEMSG_ARCHIVE_CORRUPTED, IStatus.ERROR,
|
||||
LocalServiceResources.FILEMSG_ARCHIVE_CORRUPTED, e);
|
||||
throw new SystemMessageException(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1195,6 +1192,7 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
// for 192705, we need to throw an exception when rename fails
|
||||
String msgTxt = NLS.bind(LocalServiceResources.FILEMSG_RENAME_FILE_FAILED, child.fullName);
|
||||
//String msgDetails = LocalServiceResources.FILEMSG_RENAME_FILE_FAILED_DETAILS;
|
||||
e.printStackTrace();
|
||||
throw new SystemMessageException(new SimpleSystemMessage(Activator.PLUGIN_ID,
|
||||
ILocalMessageIds.FILEMSG_RENAME_FILE_FAILED,
|
||||
IStatus.ERROR,
|
||||
|
@ -1413,6 +1411,7 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
|||
IStatus.ERROR,
|
||||
msgTxt, e));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (null != monitor)
|
||||
|
|
|
@ -124,7 +124,19 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
|||
{
|
||||
_file = file;
|
||||
_vfsLastModified = _file.lastModified();
|
||||
if (openZipFile())
|
||||
|
||||
//ignore error opening non-existing zipfile in constructor,
|
||||
//because we might want to be creating the zipfile
|
||||
boolean zipFileOpen = false;
|
||||
if (_file.exists()) {
|
||||
try {
|
||||
openZipFile();
|
||||
zipFileOpen = true;
|
||||
} catch (IOException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
if (zipFileOpen)
|
||||
{
|
||||
buildTree();
|
||||
closeZipFile();
|
||||
|
@ -1678,8 +1690,12 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
|||
String oldName = _file.getAbsolutePath();
|
||||
_zipfile.close();
|
||||
File oldFile = new File(oldName + "old"); //$NON-NLS-1$
|
||||
System.out.println(_file.renameTo(oldFile));
|
||||
System.out.println(outputTempFile.renameTo(_file));
|
||||
if (!_file.renameTo(oldFile)) {
|
||||
throw new IOException("Failed to rename " + oldFile); //$NON-NLS-1$
|
||||
}
|
||||
if (!outputTempFile.renameTo(_file)) {
|
||||
throw new IOException("Failed to rename " + _file); //$NON-NLS-1$
|
||||
}
|
||||
_vfsLastModified = _file.lastModified();
|
||||
_zipfile = new ZipFile(_file);
|
||||
oldFile.delete();
|
||||
|
@ -2114,10 +2130,11 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
|||
if (i == -1)
|
||||
{
|
||||
fullRename(fullVirtualName, newName, archiveOperationMonitor);
|
||||
} else {
|
||||
String fullNewName = fullVirtualName.substring(0, i+1) + newName;
|
||||
fullRename(fullVirtualName, fullNewName, archiveOperationMonitor);
|
||||
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
|
||||
}
|
||||
String fullNewName = fullVirtualName.substring(0, i+1) + newName;
|
||||
fullRename(fullVirtualName, fullNewName, archiveOperationMonitor);
|
||||
setArchiveOperationMonitorStatusDone(archiveOperationMonitor);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue