Class ProcessExecutionException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
AbnormalExitException

public class ProcessExecutionException extends AbstractExecutionException
An exception in the execution of a single process. If this is due to a single problem, that problem will be recorded as the cause. Otherwise, the list of problems will be recorded as suppressed exceptions.
See Also:
  • Constructor Details

    • ProcessExecutionException

      public ProcessExecutionException()
      Constructs a new ProcessExecutionException instance. The message is left blank (null), and no cause is specified.
    • ProcessExecutionException

      public ProcessExecutionException(String msg)
      Constructs a new ProcessExecutionException instance with an initial message. No cause is specified.
      Parameters:
      msg - the message
    • ProcessExecutionException

      public ProcessExecutionException(Throwable cause)
      Constructs a new ProcessExecutionException instance with an initial cause. If a non-null cause is specified, its message is used to initialize the message of this ProcessExecutionException; otherwise the message is left blank (null).
      Parameters:
      cause - the cause
    • ProcessExecutionException

      public ProcessExecutionException(String msg, Throwable cause)
      Constructs a new ProcessExecutionException instance with an initial message and cause.
      Parameters:
      msg - the message
      cause - the cause
  • Method Details

    • pid

      public long pid()
      Returns the process ID of the failed process, or -1 if it is unknown or if the process failed to start.
      Returns:
      the process ID of the failed process, or -1 if it is unknown or if the process failed to start
    • setPid

      public void setPid(long pid)
      Set the process ID of the failed process.
      Parameters:
      pid - the process ID of the failed process
    • command

      public Path command()
      Returns the command of the failed process, or null if it is unset.
      Returns:
      the command of the failed process, or null if it is unset
    • setCommand

      public void setCommand(Path command)
      Set the command of the failed process.
      Parameters:
      command - the command of the failed process (must not be null)
    • arguments

      public List<String> arguments()
      Returns the arguments of the failed process (not null). The returned list is immutable.
      Returns:
      the arguments of the failed process (not null)
    • setArguments

      public void setArguments(List<String> arguments)
      Set the arguments of the failed process.
      Parameters:
      arguments - the arguments of the failed process (must not be null)
    • showCommand

      public boolean showCommand()
      Returns true if the command and arguments should be shown in the exception message.
      Returns:
      true if the command and arguments should be shown in the exception message
    • setShowCommand

      public void setShowCommand(boolean showCommand)
      Indicate whether the command and arguments should be shown in the exception message.
      Parameters:
      showCommand - true to show the command and arguments
    • getMessage

      public StringBuilder getMessage(StringBuilder sb)
      Description copied from class: AbstractExecutionException
      Render this exception to the given string builder.
      Overrides:
      getMessage in class AbstractExecutionException
      Parameters:
      sb - the string builder (must not be null)
      Returns:
      the same string builder (not null)