Bug 67053 [Workbench] when locking fails with exception, wrong message is shown
3.0 RC2 The same message will be shown by UI when locking fails, regardless the nature of the failure. case 1) Location#lock returns false - the "Current workspace is already in use" is shown case 2) Location#lock throws an IOException - something like "An error happened trying to lock the workspace" should be shown to the user, and the IOException should be logged. The same message (case 1) is being shown in both cases. Follows the code I am talking about: public final class IDEApplication ... { ... private boolean checkInstanceLocation(Shell shell) { ... try { if (instanceLoc.lock()) { writeWorkspaceVersion(); return true; } } catch (IOException e) { // do nothing } MessageDialog.openError( shell, IDEWorkbenchMessages .getString("IDEApplication.workspaceCannotLockTitle"), //$NON-NLS-1$ IDEWorkbenchMessages .getString("IDEApplication.workspaceCannotLockMessage")); //$NON-NLS-1$ return false; ... } ... }
bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/ide/IDEApplication.java
* Write the version of the metadata into a known file overwriting any
     * existing file contents. Writing the version file isn't really crucial,
     * so the function is silent about failure
     */
    private static void writeWorkspaceVersion() {
        Location instanceLoc = Platform.getInstanceLocation();
        if (instanceLoc == null || instanceLoc.isReadOnly())
            return;
        File versionFile = getVersionFile(instanceLoc.getURL(), true);
        if (versionFile == null)
            return;
        OutputStream output = null;
        try {
            String versionLine = WORKSPACE_VERSION_KEY + '='
                    + WORKSPACE_VERSION_VALUE;
            output = new FileOutputStream(versionFile);
            output.write(versionLine.getBytes("UTF-8")); 
        } catch (IOException e) {
            IDEWorkbenchPlugin.log("Could not write version file", 
                    StatusUtil.newStatus(IStatus.ERROR, e.getMessage(), e));
        } finally {
            try {
                if (output != null)
                    output.close();
            } catch (IOException e) {
                
            }
        }
    }
    /**