Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Workbench restart incorrectly handles workspace paths containing spaces

未关闭
#4,273 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
56/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
java
领域
desktop

调研方向

Start by reading Workbench#restart(boolean useCurrentWorkspace) and compare how it builds the -data argument with Workbench#setRestartArguments(String workspacePath), as described in the issue. Reproduce by restarting with a workspace path containing a space, then check the restart arguments and workspace-selection behavior. Done when restart retains the current workspace for paths containing spaces; the issue does not name a test or file.

由索引模型根据 Issue 内容生成。

描述

bug

Let's make sure issue is not already fixed in latest builds first.

Steps to reproduce

From a fresh installation and clean workspace and configuration area:

  • Start the application with a workspace whose path contains a space, for example:
    ~/eclipse-workspaces/My Workspace
  • Restart the application

I tried

  • Restarting the application with a workspace path containing a space - the workspace selection dialog is shown again.

I expected: the application to restart using the current workspace without showing the workspace selection dialog again.

But got: The Choose a workspace dialog is displayed again after restart when the workspace path contains a space.

Root Cause (so far analysis from my end)

The issue appears to be caused by the different ways in which the -data argument is constructed during restart and workspace switching.
When restarting, Workbench#restart(boolean useCurrentWorkspace) tries to construct the restart arguments using the current instance location. During this process, the instance location URL is converted to a URI.

When the workspace path contains a space, for example:

/path/to/My Workspace

the URL-to-URI conversion results in a URISyntaxException.

Consequently, the -data argument is not correctly added to the restart arguments, which causes the application to start without the expected workspace information and display the Choose a workspace dialog again.

Interestingly, switching workspace follows a different code path.

When switching workspaces, Workbench#setRestartArguments(String workspacePath) is called internally. This method does not perform the same URL-to-URI conversion and sets the -data argument using the workspace path directly. Therefore, workspace paths containing spaces are handled correctly in that case.
In other words, there are currently two different approaches for setting the -data argument:

  • Restart: uses the instance location URL and converts it to a URI.
  • Switch workspace: uses Workbench#setRestartArguments(String workspacePath) and sets the workspace path directly.

This difference appears to be the reason why switching workspaces works correctly while restarting fails for workspace paths containing spaces.

I have only reproduced this with spaces so far. It is possible that other special characters in the workspace path may cause the same issue, but I have not tested those cases yet.

Impact on Eclipse RCP applications

This is particularly problematic for Eclipse RCP applications that use a custom IApplication implementation and do not provide a workspace selection dialog to users, as there may be no opportunity for the user to manually select the workspace again after the restart.

Our application has custom logic to set the instance location when it is not already set, which currently works around the problem.

However, this may still cause issues for RCP applications that rely on the -data argument to establish the instance location. For example, persisted instance-scope preferences may not be read from the expected location if the instance location is not correctly set.

This does not appear to be as noticeable when using the Eclipse IDE itself, but it can affect Eclipse RCP applications with custom application startup logic.

Questions

Is this a known issue, or is the current behavior intentional?
In particular, I would like to understand why restart and workspace switching use two different approaches to construct the -data argument.

Should Workbench#restart(boolean useCurrentWorkspace) use the same path-handling mechanism as Workbench#setRestartArguments(String workspacePath) so that workspace paths containing spaces and other valid special characters are handled consistently?

Tested under this environment:

  • OS & version: Windows 11
  • Eclipse IDE
    • Version: 2026-06 (4.40.0)
    • Build id: 20260604-0653

Community

  • I understand reporting an issue to this OSS project does not mandate anyone to fix it. Other contributors may consider the issue, or not, at their own convenience. The most efficient way to get it fixed is that I fix it myself and contribute it back as a good quality patch to the project.
主要语言
Java
星标
124
派生
269
平均合并
2 天 3 小时
30 天内合并 PR
71

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

eclipse-platform/eclipse.platform.ui 的其他 Issue

查看 eclipse-platform/eclipse.platform.ui 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。