vscode-java
vscode-java copied to clipboard
Path with ( causes "SyntaxError: Invalid regular expression"
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
- Set up a user in windows with a name like xxx(yyy
- Install vscode
- Install Extension
- Start vscode + extension
Current Result
SyntaxError
Expected Result
No SyntaxError. Escaping symbols in path.
Additional Informations
n/a
Looks like this is happening at https://github.com/redhat-developer/vscode-java/blob/9ab70399f0f361eb3e1cdbeba78d6a61284142fd/src/log.ts#L4-L5
https://github.com/winstonjs/winston-daily-rotate-file/issues/355 . There's already a fix in the affected library but it seems like winston-daily-rotate-file hasn't adopted the change.
@testforstephen , it doesn't look like that issue will be getting fixed. Maybe we could catch the exception and continue without logging. Would be better than outright failure to start.