Show better error message, if libunix-java.so is not available

Fixes #39
This commit is contained in:
AsamK 2016-12-22 12:37:59 +01:00
parent d89e93ad47
commit d83e0526fb

View file

@ -88,6 +88,9 @@ public class Main {
ts = (Signal) dBusConn.getRemoteObject( ts = (Signal) dBusConn.getRemoteObject(
SIGNAL_BUSNAME, SIGNAL_OBJECTPATH, SIGNAL_BUSNAME, SIGNAL_OBJECTPATH,
Signal.class); Signal.class);
} catch (UnsatisfiedLinkError e) {
System.err.println("Missing native library dependency for dbus service: " + e.getMessage());
return 1;
} catch (DBusException e) { } catch (DBusException e) {
e.printStackTrace(); e.printStackTrace();
if (dBusConn != null) { if (dBusConn != null) {
@ -350,6 +353,9 @@ public class Main {
System.out.println(); System.out.println();
} }
}); });
} catch (UnsatisfiedLinkError e) {
System.err.println("Missing native library dependency for dbus service: " + e.getMessage());
return 1;
} catch (DBusException e) { } catch (DBusException e) {
e.printStackTrace(); e.printStackTrace();
return 1; return 1;
@ -546,6 +552,9 @@ public class Main {
conn = DBusConnection.getConnection(busType); conn = DBusConnection.getConnection(busType);
conn.exportObject(SIGNAL_OBJECTPATH, m); conn.exportObject(SIGNAL_OBJECTPATH, m);
conn.requestBusName(SIGNAL_BUSNAME); conn.requestBusName(SIGNAL_BUSNAME);
} catch (UnsatisfiedLinkError e) {
System.err.println("Missing native library dependency for dbus service: " + e.getMessage());
return 1;
} catch (DBusException e) { } catch (DBusException e) {
e.printStackTrace(); e.printStackTrace();
return 2; return 2;