Skip to content

Commit

Permalink
devonfw#739: created new exception and added statement
Browse files Browse the repository at this point in the history
Added a new statement that checks if IDE_ROOT == null in EnvironmentCommanlet method. If so, it throws an empty exception
  • Loading branch information
leonrohne27 committed Nov 22, 2024
1 parent a08a986 commit 84e0250
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.devonfw.tools.ide.cli;

/**
* {@link CliException} that is thrown if IDE_ROOT == null
*/
public class NullIdeRootException extends CliException {

/**
* The constructor.
*/
public NullIdeRootException() {

super("");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.Map;
import java.util.stream.Collectors;

import com.devonfw.tools.ide.cli.NullIdeRootException;
import com.devonfw.tools.ide.context.AbstractIdeContext;
import com.devonfw.tools.ide.context.IdeContext;
import com.devonfw.tools.ide.environment.EnvironmentVariablesType;
Expand Down Expand Up @@ -52,7 +53,9 @@ public boolean isProcessableOutput() {

@Override
public void run() {

if (context.getIdeRoot() == null) {
throw new NullIdeRootException();
}
boolean winCmd = false;
WindowsPathSyntax pathSyntax = null;
if (this.context.getSystemInfo().isWindows()) {
Expand Down

0 comments on commit 84e0250

Please sign in to comment.