Actual behavior
If the PATH environment variable contains a single segment that is not a syntactically valid path for the current OS (e.g. a segment containing an illegal character such as a newline on Windows, or a NUL byte on any OS), IDEasy fails completely instead of ignoring that one entry.
SystemPath splits PATH on the path separator and calls Path.of(segment) for every segment without guarding against java.nio.file.InvalidPathException:
// cli/src/main/java/com/devonfw/tools/ide/common/SystemPath.java
String[] envPaths = envPath.split(Character.toString(pathSeparator));
for (String segment : envPaths) {
Path path = Path.of(segment); // <-- throws InvalidPathException, aborting the whole constructor
String tool = getTool(path, ideRoot);
if (tool == null) {
this.paths.add(path);
}
}
Because SystemPath is constructed during context setup, this unchecked exception propagates up and aborts the entire IDEasy invocation. A single malformed PATH entry takes the whole tool down.
Observed stack trace (Windows):
java.nio.file.InvalidPathException: Trailing char <\n> at index 43: IDE environment variables have been set for ... in workspace main
at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:203)
at java.base/java.nio.file.Path.of(Path.java:148)
at com.devonfw.tools.ide.common.SystemPath.<init>(SystemPath.java:99)
Reproduce
Unit-level (deterministic, OS-independent), e.g. a PATH entry containing an illegal NUL character:
String envPath = "C:\\Tools\\bin" + ';' + ("broken" + (char) 0 + "entry") + ';' + "C:\\Other\\bin";
new SystemPath(context, envPath, ideRoot, softwarePath, ';', List.of());
// -> throws InvalidPathException instead of skipping the single bad entry
Real-world trigger that surfaced this: on Windows a PATH value ended up containing an embedded newline / non-path text (a stdout line leaking into PATH, e.g. the human-readable activation banner "IDE environment variables have been set for ... in workspace main" followed by a newline). Any subsequent ide ... command then aborts before doing anything useful.
Expected behavior
A single malformed PATH entry should not break IDEasy. The invalid entry should be skipped and a warning logged, while all valid entries continue to be processed normally — consistent with how IDEasy already handles other malformed configuration (e.g. invalid variable definitions are skipped with a warning rather than aborting).
Expected log (example):
WARNING Ignoring invalid PATH entry 'broken<NUL>entry' - Illegal char <NUL> at index 6: broken<NUL>entry
IDEasy status
Reproduced against current main (version dev-SNAPSHOT).
Your operating system is windows(10.0)@x64 [Windows 11@amd64]
Comments/Hints
- Root cause is the unguarded
Path.of(segment) at cli/src/main/java/com/devonfw/tools/ide/common/SystemPath.java:99.
- Suggested fix: wrap the per-segment
Path.of(...) in a try/catch (InvalidPathException), log a warning via SLF4J, and continue to the next segment. Small, localized robustness improvement (defense-in-depth); no behavior change for well-formed PATH values.
- This is a pre-existing latent robustness gap; it is only exposed by a corrupted environment, not caused by it.
Actual behavior
If the
PATHenvironment variable contains a single segment that is not a syntactically valid path for the current OS (e.g. a segment containing an illegal character such as a newline on Windows, or aNULbyte on any OS), IDEasy fails completely instead of ignoring that one entry.SystemPathsplitsPATHon the path separator and callsPath.of(segment)for every segment without guarding againstjava.nio.file.InvalidPathException:Because
SystemPathis constructed during context setup, this unchecked exception propagates up and aborts the entire IDEasy invocation. A single malformedPATHentry takes the whole tool down.Observed stack trace (Windows):
Reproduce
Unit-level (deterministic, OS-independent), e.g. a
PATHentry containing an illegalNULcharacter:Real-world trigger that surfaced this: on Windows a
PATHvalue ended up containing an embedded newline / non-path text (a stdout line leaking intoPATH, e.g. the human-readable activation banner"IDE environment variables have been set for ... in workspace main"followed by a newline). Any subsequentide ...command then aborts before doing anything useful.Expected behavior
A single malformed
PATHentry should not break IDEasy. The invalid entry should be skipped and a warning logged, while all valid entries continue to be processed normally — consistent with how IDEasy already handles other malformed configuration (e.g. invalid variable definitions are skipped with a warning rather than aborting).Expected log (example):
IDEasy status
Comments/Hints
Path.of(segment)atcli/src/main/java/com/devonfw/tools/ide/common/SystemPath.java:99.Path.of(...)in atry/catch (InvalidPathException), log a warning via SLF4J, andcontinueto the next segment. Small, localized robustness improvement (defense-in-depth); no behavior change for well-formedPATHvalues.