This repository was archived by the owner on Dec 25, 2024. It is now read-only.
This repository was archived by the owner on Dec 25, 2024. It is now read-only.
[BUG] Unescaped trailing backslash when replacing file separators on Windows #446
Closed
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request
Description
To determine ModuleLocation, replaceAll is used on File.separator, which is "" on Windows systems.
mystring.replaceAll(String.valueOf(File.separatorChar), ".")
replaceAll is expecting a regex to replace, but "" is a reserved character in regex. An error is thrown:
java.util.regex.PatternSyntaxException: Unescaped trailing backslash near index 1
If you just replace all occurrences of .replaceAll(String.valueOf(File.separatorChar) with replace(File.separatorChar, '.'), it will work.
openapi-json-schema-generator version
4.5.1
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Just execute: "test\test1\test2".replaceAll(String.valueOf(File.separatorChar), ".") on Windows
Related issues/PRs
Suggest a fix
Exchange replaceAll with replace