mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-17 22:15:23 +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
|
try
|
||||||
{
|
{
|
||||||
fileToCreate.createNewFile();
|
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);
|
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
|
else
|
||||||
|
@ -1195,6 +1192,7 @@ 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;
|
||||||
|
e.printStackTrace();
|
||||||
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,
|
IStatus.ERROR,
|
||||||
|
@ -1413,6 +1411,7 @@ public class LocalFileService extends AbstractFileService implements ILocalServi
|
||||||
IStatus.ERROR,
|
IStatus.ERROR,
|
||||||
msgTxt, e));
|
msgTxt, e));
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (null != monitor)
|
if (null != monitor)
|
||||||
|
|
|
@ -124,7 +124,19 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
{
|
{
|
||||||
_file = file;
|
_file = file;
|
||||||
_vfsLastModified = _file.lastModified();
|
_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();
|
buildTree();
|
||||||
closeZipFile();
|
closeZipFile();
|
||||||
|
@ -1678,8 +1690,12 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
String oldName = _file.getAbsolutePath();
|
String oldName = _file.getAbsolutePath();
|
||||||
_zipfile.close();
|
_zipfile.close();
|
||||||
File oldFile = new File(oldName + "old"); //$NON-NLS-1$
|
File oldFile = new File(oldName + "old"); //$NON-NLS-1$
|
||||||
System.out.println(_file.renameTo(oldFile));
|
if (!_file.renameTo(oldFile)) {
|
||||||
System.out.println(outputTempFile.renameTo(_file));
|
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();
|
_vfsLastModified = _file.lastModified();
|
||||||
_zipfile = new ZipFile(_file);
|
_zipfile = new ZipFile(_file);
|
||||||
oldFile.delete();
|
oldFile.delete();
|
||||||
|
@ -2114,10 +2130,11 @@ public class SystemZipHandler implements ISystemArchiveHandler
|
||||||
if (i == -1)
|
if (i == -1)
|
||||||
{
|
{
|
||||||
fullRename(fullVirtualName, newName, archiveOperationMonitor);
|
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