]> nmode's Git Repositories - signal-cli/blobdiff - src/main/java/org/asamk/signal/App.java
Update dbus-java
[signal-cli] / src / main / java / org / asamk / signal / App.java
index 5853e4b8322bec2773d73ad2196e909d805aea1d..f500d818d26a04db75f2e9f56d572e8ede4823b6 100644 (file)
@@ -34,6 +34,7 @@ import org.asamk.signal.output.OutputWriter;
 import org.asamk.signal.output.PlainTextWriterImpl;
 import org.asamk.signal.util.IOUtils;
 import org.freedesktop.dbus.connections.impl.DBusConnection;
+import org.freedesktop.dbus.connections.impl.DBusConnectionBuilder;
 import org.freedesktop.dbus.errors.ServiceUnknown;
 import org.freedesktop.dbus.errors.UnknownMethod;
 import org.freedesktop.dbus.exceptions.DBusException;
@@ -163,10 +164,15 @@ public class App {
                 ? TrustNewIdentity.ON_FIRST_USE
                 : trustNewIdentityCli == TrustNewIdentityCli.ALWAYS ? TrustNewIdentity.ALWAYS : TrustNewIdentity.NEVER;
 
-        final SignalAccountFiles signalAccountFiles = new SignalAccountFiles(configPath,
-                serviceEnvironment,
-                BaseConfig.USER_AGENT,
-                trustNewIdentity);
+        final SignalAccountFiles signalAccountFiles;
+        try {
+            signalAccountFiles = new SignalAccountFiles(configPath,
+                    serviceEnvironment,
+                    BaseConfig.USER_AGENT,
+                    trustNewIdentity);
+        } catch (IOException e) {
+            throw new IOErrorException("Failed to read local accounts list", e);
+        }
 
         if (command instanceof ProvisioningCommand provisioningCommand) {
             if (account != null) {
@@ -360,7 +366,7 @@ public class App {
             } else {
                 busType = DBusConnection.DBusBusType.SESSION;
             }
-            try (var dBusConn = DBusConnection.getConnection(busType)) {
+            try (var dBusConn = DBusConnectionBuilder.forType(busType).build()) {
                 if (command instanceof ProvisioningCommand c) {
                     if (account != null) {
                         throw new UserErrorException("You cannot specify a account (phone number) when linking");