瀏覽代碼

Logging IOExceptions in main method.

Sebastian Stenzel 8 年之前
父節點
當前提交
e63cbf94d0

+ 3 - 1
main/launcher/src/main/java/org/cryptomator/launcher/Cryptomator.java

@@ -17,7 +17,7 @@ public class Cryptomator {
 	private static final Logger LOG = LoggerFactory.getLogger(Cryptomator.class);
 	static final BlockingQueue<Path> FILE_OPEN_REQUESTS = new ArrayBlockingQueue<>(10);
 
-	public static void main(String[] args) throws IOException {
+	public static void main(String[] args) {
 		LOG.info("Starting Cryptomator {} on {} {} ({})", ApplicationVersion.orElse("SNAPSHOT"), SystemUtils.OS_NAME, SystemUtils.OS_VERSION, SystemUtils.OS_ARCH);
 
 		FileOpenRequestHandler fileOpenRequestHandler = new FileOpenRequestHandler(FILE_OPEN_REQUESTS);
@@ -30,6 +30,8 @@ public class Cryptomator {
 				communicator.handleLaunchArgs(args);
 				LOG.info("Found running application instance. Shutting down.");
 			}
+		} catch (IOException e) {
+			LOG.error("Failed to initiate inter-process communication.", e);
 		}
 		System.exit(0); // end remaining non-daemon threads.
 	}

+ 4 - 5
main/launcher/src/main/java/org/cryptomator/launcher/InterProcessCommunicator.java

@@ -12,7 +12,6 @@ import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.nio.file.StandardOpenOption;
 import java.rmi.ConnectException;
-import java.rmi.NoSuchObjectException;
 import java.rmi.NotBoundException;
 import java.rmi.Remote;
 import java.rmi.RemoteException;
@@ -113,7 +112,7 @@ abstract class InterProcessCommunicator implements InterProcessCommunicationProt
 		}
 
 		@Override
-		public void close() throws IOException {
+		public void close() {
 			// no-op
 		}
 
@@ -150,14 +149,14 @@ abstract class InterProcessCommunicator implements InterProcessCommunicationProt
 		}
 
 		@Override
-		public void close() throws IOException {
+		public void close() {
 			try {
 				registry.unbind(RMI_NAME);
 				UnicastRemoteObject.unexportObject(remote, true);
 				socket.close();
 				LOG.debug("Server shut down.");
-			} catch (NotBoundException | NoSuchObjectException e) {
-				// ignore
+			} catch (NotBoundException | IOException e) {
+				LOG.warn("Failed to close IPC Server.", e);
 			}
 		}