redhat-developer / redhat-developer/vscode-java

Path with ( causes "SyntaxError: Invalid regular expression"

Open
#3,475 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug upstream
Dominant language
TypeScript
Stars
2.3k
Forks
546
Avg merge
20h 1m
Merged PRs (30d)
11

Description

Due to naming conventions and limitations of windows, my username has an opening bracket in it.
This bracket causes a SyntaxError since the path to %APPDATA% gets evaluated as regular Expression

2024-01-24 13:43:01.810 [error] Activating extension redhat.java failed due to an error:
2024-01-24 13:43:01.810 [error] SyntaxError: Invalid regular expression: /c:\Users\xxxxusernamexxxx(xxx\AppData\Roaming\Code\User\workspaceStorage\xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\redhat.java\client.log.2024-01-24/: Unterminated group
	at String.match (<anonymous>)
	at c.getStream (c:\Users\xxxxusernamexxxx(xxx\.vscode\extensions\redhat.java-1.26.0-win32-x64\dist\extension.js:2:294045)
	at new m (c:\Users\xxxxusernamexxxx(xxx\.vscode\extensions\redhat.java-1.26.0-win32-x64\dist\extension.js:2:1453936)
	at t.initializeLogFile (c:\Users\xxxxusernamexxxx(xxx\.vscode\extensions\redhat.java-1.26.0-win32-x64\dist\extension.js:2:953503)
	at c:\Users\xxxxusernamexxxx(xxx\.vscode\extensions\redhat.java-1.26.0-win32-x64\dist\extension.js:2:915356
	at Generator.next (<anonymous>)
	at o (c:\Users\xxxxusernamexxxx(xxx\.vscode\extensions\redhat.java-1.26.0-win32-x64\dist\extension.js:2:907644)
Environment
  • Operating System: Windows 11
  • JDK version: openjdk version "11.0.0.1"
  • Visual Studio Code version: 1.85.2
  • Java extension version: v1.26.0
Steps To Reproduce
  1. Set up a user in windows with a name like xxx(yyy
  2. Install vscode
  3. Install Extension
  4. Start vscode + extension
Current Result

SyntaxError

Expected Result

No SyntaxError.
Escaping symbols in path.

Additional Informations

n/a

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure on Windows with a user path containing (, then start at c.getStream in the reported dist/extension.js stack trace and trace the path matching logic. Done means the Java extension starts without a regular-expression SyntaxError for that path; no source test file is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, typescript, vscode
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.