var outputType = outputTypeInput == null
? command.getSupportedOutputTypes().stream().findFirst().orElse(null)
: outputTypeInput;
var outputType = outputTypeInput == null
? command.getSupportedOutputTypes().stream().findFirst().orElse(null)
: outputTypeInput;
if (outputWriter != null && !command.getSupportedOutputTypes().contains(outputType)) {
throw new UserErrorException("Command doesn't support output type " + outputType);
if (outputWriter != null && !command.getSupportedOutputTypes().contains(outputType)) {
throw new UserErrorException("Command doesn't support output type " + outputType);
Command command, Signal ts, DBusConnection dBusConn, OutputWriter outputWriter
) throws CommandException {
if (command instanceof LocalCommand localCommand) {
Command command, Signal ts, DBusConnection dBusConn, OutputWriter outputWriter
) throws CommandException {
if (command instanceof LocalCommand localCommand) {
- try {
- localCommand.handleCommand(ns, new DbusManagerImpl(ts, dBusConn), outputWriter);
+ try (final var m = new DbusManagerImpl(ts, dBusConn)) {
+ localCommand.handleCommand(ns, m, outputWriter);
} catch (UnsupportedOperationException e) {
throw new UserErrorException("Command is not yet implemented via dbus", e);
} catch (UnsupportedOperationException e) {
throw new UserErrorException("Command is not yet implemented via dbus", e);