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
* The version file is stored in the metadata area of the workspace. This
     * method returns an URL to the file or null if the directory or file does
     * not exist (and the create parameter is false).
     * 
     * @param create
     *            If the directory and file does not exist this parameter
     *            controls whether it will be created.
     * @return An url to the file or null if the version file does not exist or
     *         could not be created.
     */
    private static File getVersionFile(URL workspaceUrl, boolean create) {
        if (workspaceUrl == null)
            return null;
        try {
            
            File metaDir = new File(workspaceUrl.getPath(), METADATA_FOLDER);
            if (!metaDir.exists() && (!create || !metaDir.mkdir()))
                return null;
            
            File versionFile = new File(metaDir, VERSION_FILENAME);
            if (!versionFile.exists()
                    && (!create || !versionFile.createNewFile()))
                return null;
            return versionFile;
        } catch (IOException e) {
            
            return null;
        }
    }
}