|
Lines 1201-1208
Link Here
|
| 1201 |
try { |
1201 |
try { |
| 1202 |
masterTable.store(output, "master table"); //$NON-NLS-1$ |
1202 |
masterTable.store(output, "master table"); //$NON-NLS-1$ |
| 1203 |
output.succeed(); |
1203 |
output.succeed(); |
| 1204 |
} finally { |
|
|
| 1205 |
output.close(); |
1204 |
output.close(); |
|
|
1205 |
} finally { |
| 1206 |
FileUtil.safeClose(output); |
| 1206 |
} |
1207 |
} |
| 1207 |
} catch (IOException e) { |
1208 |
} catch (IOException e) { |
| 1208 |
throw new ResourceException(IResourceStatus.INTERNAL_ERROR, null, NLS.bind(Messages.resources_exSaveMaster, location.toOSString()), e); |
1209 |
throw new ResourceException(IResourceStatus.INTERNAL_ERROR, null, NLS.bind(Messages.resources_exSaveMaster, location.toOSString()), e); |
|
Lines 1278-1285
Link Here
|
| 1278 |
try { |
1279 |
try { |
| 1279 |
output.writeInt(ICoreConstants.WORKSPACE_TREE_VERSION_2); |
1280 |
output.writeInt(ICoreConstants.WORKSPACE_TREE_VERSION_2); |
| 1280 |
writeTree(project, output, monitor); |
1281 |
writeTree(project, output, monitor); |
| 1281 |
} finally { |
|
|
| 1282 |
output.close(); |
1282 |
output.close(); |
|
|
1283 |
} finally { |
| 1284 |
FileUtil.safeClose(output); |
| 1283 |
} |
1285 |
} |
| 1284 |
OutputStream snapOut = store.openOutputStream(EFS.NONE, monitor); |
1286 |
OutputStream snapOut = store.openOutputStream(EFS.NONE, monitor); |
| 1285 |
out = new ZipOutputStream(snapOut); |
1287 |
out = new ZipOutputStream(snapOut); |
|
Lines 1295-1308
Link Here
|
| 1295 |
} |
1297 |
} |
| 1296 |
out.closeEntry(); |
1298 |
out.closeEntry(); |
| 1297 |
} finally { |
1299 |
} finally { |
| 1298 |
in.close(); |
1300 |
FileUtil.safeClose(in); |
| 1299 |
} |
1301 |
} |
|
|
1302 |
out.close(); |
| 1300 |
} catch (IOException e) { |
1303 |
} catch (IOException e) { |
| 1301 |
throw new ResourceException(IResourceStatus.FAILED_WRITE_LOCAL, snapshotPath, Messages.resources_copyProblem, e); |
1304 |
throw new ResourceException(IResourceStatus.FAILED_WRITE_LOCAL, snapshotPath, Messages.resources_copyProblem, e); |
| 1302 |
} finally { |
1305 |
} finally { |
| 1303 |
if (out!=null) { |
1306 |
FileUtil.safeClose(out); |
| 1304 |
try { out.close(); } catch (IOException e) { /*ignore*/ } |
|
|
| 1305 |
} |
| 1306 |
if (tmpTree!=null) tmpTree.delete(); |
1307 |
if (tmpTree!=null) tmpTree.delete(); |
| 1307 |
} |
1308 |
} |
| 1308 |
} |
1309 |
} |
|
Lines 1322-1329
Link Here
|
| 1322 |
try { |
1323 |
try { |
| 1323 |
output.writeInt(ICoreConstants.WORKSPACE_TREE_VERSION_2); |
1324 |
output.writeInt(ICoreConstants.WORKSPACE_TREE_VERSION_2); |
| 1324 |
writeTree(computeStatesToSave(contexts, workspace.getElementTree()), output, monitor); |
1325 |
writeTree(computeStatesToSave(contexts, workspace.getElementTree()), output, monitor); |
| 1325 |
} finally { |
|
|
| 1326 |
output.close(); |
1326 |
output.close(); |
|
|
1327 |
} finally { |
| 1328 |
FileUtil.safeClose(output); |
| 1327 |
} |
1329 |
} |
| 1328 |
} catch (Exception e) { |
1330 |
} catch (Exception e) { |
| 1329 |
String msg = NLS.bind(Messages.resources_writeWorkspaceMeta, treeLocation); |
1331 |
String msg = NLS.bind(Messages.resources_writeWorkspaceMeta, treeLocation); |
|
Lines 1549-1560
Link Here
|
| 1549 |
if (root.getType() != IResource.ROOT) |
1551 |
if (root.getType() != IResource.ROOT) |
| 1550 |
o2 = new DataOutputStream(new SafeFileOutputStream(syncInfoLocation.toOSString(), syncInfoTempLocation.toOSString())); |
1552 |
o2 = new DataOutputStream(new SafeFileOutputStream(syncInfoLocation.toOSString(), syncInfoTempLocation.toOSString())); |
| 1551 |
} catch (IOException e) { |
1553 |
} catch (IOException e) { |
| 1552 |
if (o1 != null) |
1554 |
FileUtil.safeClose(o1); |
| 1553 |
try { |
|
|
| 1554 |
o1.close(); |
| 1555 |
} catch (IOException e2) { |
| 1556 |
// ignore |
| 1557 |
} |
| 1558 |
message = NLS.bind(Messages.resources_writeMeta, root.getFullPath()); |
1555 |
message = NLS.bind(Messages.resources_writeMeta, root.getFullPath()); |
| 1559 |
throw new ResourceException(IResourceStatus.FAILED_WRITE_METADATA, root.getFullPath(), message, e); |
1556 |
throw new ResourceException(IResourceStatus.FAILED_WRITE_METADATA, root.getFullPath(), message, e); |
| 1560 |
} |
1557 |
} |
|
Lines 1610-1617
Link Here
|
| 1610 |
removeGarbage(markersOutput, markersLocation, markersTempLocation); |
1607 |
removeGarbage(markersOutput, markersLocation, markersTempLocation); |
| 1611 |
// if we have the workspace root the output stream will be null and we |
1608 |
// if we have the workspace root the output stream will be null and we |
| 1612 |
// don't have to perform cleanup code |
1609 |
// don't have to perform cleanup code |
| 1613 |
if (syncInfoOutput != null) |
1610 |
if (syncInfoOutput != null) { |
| 1614 |
removeGarbage(syncInfoOutput, syncInfoLocation, syncInfoTempLocation); |
1611 |
removeGarbage(syncInfoOutput, syncInfoLocation, syncInfoTempLocation); |
|
|
1612 |
syncInfoOutput.close(); |
| 1613 |
} |
| 1614 |
markersOutput.close(); |
| 1615 |
} catch (IOException e) { |
1615 |
} catch (IOException e) { |
| 1616 |
message = NLS.bind(Messages.resources_writeMeta, root.getFullPath()); |
1616 |
message = NLS.bind(Messages.resources_writeMeta, root.getFullPath()); |
| 1617 |
throw new ResourceException(IResourceStatus.FAILED_WRITE_METADATA, root.getFullPath(), message, e); |
1617 |
throw new ResourceException(IResourceStatus.FAILED_WRITE_METADATA, root.getFullPath(), message, e); |
|
Lines 1719-1726
Link Here
|
| 1719 |
System.out.println("Snap SyncInfo for " + root.getFullPath() + ": " + snapTimes[1] + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
1719 |
System.out.println("Snap SyncInfo for " + root.getFullPath() + ": " + snapTimes[1] + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ |
| 1720 |
if (markerFileSize != markersOutput.size()) |
1720 |
if (markerFileSize != markersOutput.size()) |
| 1721 |
safeMarkerStream.succeed(); |
1721 |
safeMarkerStream.succeed(); |
| 1722 |
if (safeSyncInfoStream != null && syncInfoFileSize != syncInfoOutput.size()) |
1722 |
if (safeSyncInfoStream != null && syncInfoFileSize != syncInfoOutput.size()) { |
| 1723 |
safeSyncInfoStream.succeed(); |
1723 |
safeSyncInfoStream.succeed(); |
|
|
1724 |
syncInfoOutput.close(); |
| 1725 |
} |
| 1726 |
markersOutput.close(); |
| 1724 |
} catch (IOException e) { |
1727 |
} catch (IOException e) { |
| 1725 |
message = NLS.bind(Messages.resources_writeMeta, root.getFullPath()); |
1728 |
message = NLS.bind(Messages.resources_writeMeta, root.getFullPath()); |
| 1726 |
throw new ResourceException(IResourceStatus.FAILED_WRITE_METADATA, root.getFullPath(), message, e); |
1729 |
throw new ResourceException(IResourceStatus.FAILED_WRITE_METADATA, root.getFullPath(), message, e); |
|
Lines 1969-1977
Link Here
|
| 1969 |
output.writeUTF((String) it.next()); |
1972 |
output.writeUTF((String) it.next()); |
| 1970 |
for (Iterator it = additionalConfigNames.iterator(); it.hasNext();) |
1973 |
for (Iterator it = additionalConfigNames.iterator(); it.hasNext();) |
| 1971 |
output.writeUTF((String) it.next()); |
1974 |
output.writeUTF((String) it.next()); |
|
|
1975 |
output.close(); |
| 1972 |
} finally { |
1976 |
} finally { |
| 1973 |
if (output != null) |
1977 |
FileUtil.safeClose(output); |
| 1974 |
output.close(); |
|
|
| 1975 |
if (!wasImmutable) |
1978 |
if (!wasImmutable) |
| 1976 |
workspace.newWorkingTree(); |
1979 |
workspace.newWorkingTree(); |
| 1977 |
} |
1980 |
} |
|
Lines 1990-1997
Link Here
|
| 1990 |
DataOutputStream output = new DataOutputStream(safe); |
1993 |
DataOutputStream output = new DataOutputStream(safe); |
| 1991 |
output.writeInt(ICoreConstants.WORKSPACE_TREE_VERSION_2); |
1994 |
output.writeInt(ICoreConstants.WORKSPACE_TREE_VERSION_2); |
| 1992 |
writeTree(project, output, null); |
1995 |
writeTree(project, output, null); |
| 1993 |
} finally { |
|
|
| 1994 |
safe.close(); |
1996 |
safe.close(); |
|
|
1997 |
} finally { |
| 1998 |
FileUtil.safeClose(safe); |
| 1995 |
} |
1999 |
} |
| 1996 |
} catch (IOException e) { |
2000 |
} catch (IOException e) { |
| 1997 |
String msg = NLS.bind(Messages.resources_writeMeta, project.getFullPath()); |
2001 |
String msg = NLS.bind(Messages.resources_writeMeta, project.getFullPath()); |