Skip to content

Commit

Permalink
Extract utils methods
Browse files Browse the repository at this point in the history
  • Loading branch information
AsamK committed Nov 18, 2018
1 parent 35c72f6 commit 184354f
Show file tree
Hide file tree
Showing 4 changed files with 272 additions and 224 deletions.
21 changes: 9 additions & 12 deletions src/main/java/org/asamk/signal/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@

public class Main {

public static final String SIGNAL_BUSNAME = "org.asamk.Signal";
public static final String SIGNAL_OBJECTPATH = "/org/asamk/Signal";
private static final String SIGNAL_BUSNAME = "org.asamk.Signal";
private static final String SIGNAL_OBJECTPATH = "/org/asamk/Signal";

public static void main(String[] args) {
// Workaround for BKS truststore
Expand Down Expand Up @@ -286,15 +286,12 @@ private static int handleCommands(Namespace ns) {
} catch (IOException e) {
e.printStackTrace();
return 3;
} catch (InvalidKeyException e) {
} catch (InvalidKeyException | URISyntaxException e) {
e.printStackTrace();
return 2;
} catch (AssertionError e) {
handleAssertionError(e);
return 1;
} catch (URISyntaxException e) {
e.printStackTrace();
return 2;
}
break;
case "listDevices":
Expand Down Expand Up @@ -528,9 +525,9 @@ public void handle(Signal.ReceiptReceived s) {
if (groupName == null) {
groupName = "";
}
List<String> groupMembers = ns.<String>getList("member");
List<String> groupMembers = ns.getList("member");
if (groupMembers == null) {
groupMembers = new ArrayList<String>();
groupMembers = new ArrayList<>();
}
String groupAvatar = ns.getString("avatar");
if (groupAvatar == null) {
Expand Down Expand Up @@ -943,7 +940,7 @@ private static class ReceiveMessageHandler implements Manager.ReceiveMessageHand

final Manager m;

public ReceiveMessageHandler(Manager m) {
ReceiveMessageHandler(Manager m) {
this.m = m;
}

Expand Down Expand Up @@ -1207,7 +1204,7 @@ private static class DbusReceiveMessageHandler extends ReceiveMessageHandler {

final DBusConnection conn;

public DbusReceiveMessageHandler(Manager m, DBusConnection conn) {
DbusReceiveMessageHandler(Manager m, DBusConnection conn) {
super(m);
this.conn = conn;
}
Expand All @@ -1225,7 +1222,7 @@ private static class JsonReceiveMessageHandler implements Manager.ReceiveMessage
final Manager m;
final ObjectMapper jsonProcessor;

public JsonReceiveMessageHandler(Manager m) {
JsonReceiveMessageHandler(Manager m) {
this.m = m;
this.jsonProcessor = new ObjectMapper();
jsonProcessor.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); // disable autodetect
Expand Down Expand Up @@ -1256,7 +1253,7 @@ private static class JsonDbusReceiveMessageHandler extends JsonReceiveMessageHan

final DBusConnection conn;

public JsonDbusReceiveMessageHandler(Manager m, DBusConnection conn) {
JsonDbusReceiveMessageHandler(Manager m, DBusConnection conn) {
super(m);
this.conn = conn;
}
Expand Down
Loading

0 comments on commit 184354f

Please sign in to comment.